Skip to content

Commit

Permalink
Merge pull request #81 from Cerebellum-Network/feature/ddc-customers-…
Browse files Browse the repository at this point in the history
…bucket-removed

Bucket removal flag and event
  • Loading branch information
khssnv authored Mar 14, 2024
2 parents 41380fa + 032c4fd commit 098b39c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
6 changes: 6 additions & 0 deletions blockchain/pallets/ddccustomers.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type Bucket struct {
OwnerId types.AccountID
ClusterId ClusterId
IsPublic types.Bool
IsRemoved types.Bool
}

type UnlockChunk struct {
Expand Down Expand Up @@ -61,6 +62,11 @@ type (
BucketId BucketId
Topics []types.Hash
}
EventDdcCustomersBucketRemoved struct {
Phase types.Phase
BucketId BucketId
Topics []types.Hash
}
)

type DdcCustomersApi interface {
Expand Down
1 change: 1 addition & 0 deletions blockchain/pallets/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type Events struct {
DdcCustomers_Charged []EventDdcCustomersCharged //nolint:stylecheck,golint
DdcCustomers_BucketCreated []EventDdcCustomersBucketCreated //nolint:stylecheck,golint
DdcCustomers_BucketUpdated []EventDdcCustomersBucketUpdated //nolint:stylecheck,golint
DdcCustomers_BucketRemoved []EventDdcCustomersBucketRemoved //nolint:stylecheck,golint

DdcPayouts_BillingReportInitialized []EventDdcPayoutsBillingReportInitialized //nolint:stylecheck,golint
DdcPayouts_ChargingStarted []EventDdcPayoutsChargingStarted //nolint:stylecheck,golint
Expand Down
19 changes: 6 additions & 13 deletions blockchain/pallets/primitives.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,30 +97,23 @@ func (m *StorageNodeMode) Decode(decoder scale.Decoder) error {
return ErrUnknownVariant
}

if err != nil {
return err
}

return nil
}

func (m StorageNodeMode) Encode(encoder scale.Encoder) error {
var err1, err2 error
var err error
if m.IsFull {
err1 = encoder.PushByte(1)
err = encoder.PushByte(1)
} else if m.IsStorage {
err1 = encoder.PushByte(2)
err = encoder.PushByte(2)
} else if m.IsCache {
err1 = encoder.PushByte(3)
err = encoder.PushByte(3)
} else {
return ErrUnknownVariant
}

if err1 != nil {
return err1
}
if err2 != nil {
return err2
if err != nil {
return err
}

return nil
Expand Down

0 comments on commit 098b39c

Please sign in to comment.