numassigner: SectorNumReserveCount

This commit is contained in:
Łukasz Magiera
2022-08-24 11:25:37 -04:00
parent b290dac3cb
commit 335f5df3ec
13 changed files with 272 additions and 100 deletions
+16 -4
View File
@@ -125,10 +125,19 @@ type StorageMiner interface {
SectorAbortUpgrade(context.Context, abi.SectorNumber) error //perm:admin
// SectorNumAssignerMeta returns sector number assigner metadata - reserved/allocated
SectorNumAssignerMeta(ctx context.Context) (NumAssignerMeta, error) //perm:read
SectorNumReservations(ctx context.Context) (map[string]bitfield.BitField, error) //perm:read
SectorNumReserve(ctx context.Context, name string, field bitfield.BitField, force bool) error //perm:admin
SectorNumFree(ctx context.Context, name string) error //perm:admin
SectorNumAssignerMeta(ctx context.Context) (NumAssignerMeta, error) //perm:read
// SectorNumReservations returns a list of sector number reservations
SectorNumReservations(ctx context.Context) (map[string]bitfield.BitField, error) //perm:read
// SectorNumReserve creates a new sector number reservation. Will fail if any other reservation has colliding
// numbers or name. Set force to true to override safety checks.
// Valid characters for name: a-z, A-Z, 0-9, _, -
SectorNumReserve(ctx context.Context, name string, sectors bitfield.BitField, force bool) error //perm:admin
// SectorNumReserveCount creates a new sector number reservation for `count` sector numbers.
// by default lotus will allocate lowest-available sector numbers to the reservation.
// For restrictions on `name` see SectorNumReserve
SectorNumReserveCount(ctx context.Context, name string, count uint64) (bitfield.BitField, error) //perm:admin
// SectorNumFree drops a sector reservation
SectorNumFree(ctx context.Context, name string) error //perm:admin
// WorkerConnect tells the node to connect to workers RPC
WorkerConnect(context.Context, string) error //perm:admin retry:true
@@ -480,5 +489,8 @@ type NumAssignerMeta struct {
Reserved bitfield.BitField
Allocated bitfield.BitField
// ChainAllocated+Reserved+Allocated
InUse bitfield.BitField
Next abi.SectorNumber
}
+13
View File
@@ -836,6 +836,8 @@ type StorageMinerStruct struct {
SectorNumReserve func(p0 context.Context, p1 string, p2 bitfield.BitField, p3 bool) error `perm:"admin"`
SectorNumReserveCount func(p0 context.Context, p1 string, p2 uint64) (bitfield.BitField, error) `perm:"admin"`
SectorPreCommitFlush func(p0 context.Context) ([]sealiface.PreCommitBatchRes, error) `perm:"admin"`
SectorPreCommitPending func(p0 context.Context) ([]abi.SectorID, error) `perm:"admin"`
@@ -4978,6 +4980,17 @@ func (s *StorageMinerStub) SectorNumReserve(p0 context.Context, p1 string, p2 bi
return ErrNotSupported
}
func (s *StorageMinerStruct) SectorNumReserveCount(p0 context.Context, p1 string, p2 uint64) (bitfield.BitField, error) {
if s.Internal.SectorNumReserveCount == nil {
return *new(bitfield.BitField), ErrNotSupported
}
return s.Internal.SectorNumReserveCount(p0, p1, p2)
}
func (s *StorageMinerStub) SectorNumReserveCount(p0 context.Context, p1 string, p2 uint64) (bitfield.BitField, error) {
return *new(bitfield.BitField), ErrNotSupported
}
func (s *StorageMinerStruct) SectorPreCommitFlush(p0 context.Context) ([]sealiface.PreCommitBatchRes, error) {
if s.Internal.SectorPreCommitFlush == nil {
return *new([]sealiface.PreCommitBatchRes), ErrNotSupported