Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bucket removal flag and event #81

Merged
merged 4 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading