From 99ceb7290befc359e7a750c84c08560b32425ea7 Mon Sep 17 00:00:00 2001 From: "Alisher A. Khassanov" Date: Thu, 8 Aug 2024 13:25:45 +0500 Subject: [PATCH 1/4] Add new `CustomerUsage` type --- blockchain/pallets/primitives.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/blockchain/pallets/primitives.go b/blockchain/pallets/primitives.go index d65fc12..83a9d62 100644 --- a/blockchain/pallets/primitives.go +++ b/blockchain/pallets/primitives.go @@ -169,3 +169,10 @@ func (m ClusterStatus) Encode(encoder scale.Encoder) error { return nil } + +type CustomerUsage struct { + TransferredBytes types.U64 + StoredBytes types.I64 + NumberOfPuts types.U64 + NumberOfGets types.U64 +} From 60402ee7baa096794369c37e3af1d6334e13a018 Mon Sep 17 00:00:00 2001 From: "Alisher A. Khassanov" Date: Thu, 8 Aug 2024 13:26:37 +0500 Subject: [PATCH 2/4] Add `CustomerUsage` type field to `Bucket` type --- blockchain/pallets/ddccustomers.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/blockchain/pallets/ddccustomers.go b/blockchain/pallets/ddccustomers.go index e361aa4..21831a3 100644 --- a/blockchain/pallets/ddccustomers.go +++ b/blockchain/pallets/ddccustomers.go @@ -14,11 +14,12 @@ type AccountsLedger struct { } type Bucket struct { - BucketId BucketId - OwnerId types.AccountID - ClusterId ClusterId - IsPublic types.Bool - IsRemoved types.Bool + BucketId BucketId + OwnerId types.AccountID + ClusterId ClusterId + IsPublic types.Bool + IsRemoved types.Bool + TotalCustomersUsage types.Option[CustomerUsage] } type UnlockChunk struct { From 9496c76253f01d1b95e3e2b9ac27ca492e83a0af Mon Sep 17 00:00:00 2001 From: "Alisher A. Khassanov" Date: Thu, 8 Aug 2024 15:11:40 +0500 Subject: [PATCH 3/4] Add `LastValidatedEraId` field to `Cluster` type --- blockchain/pallets/ddcclusters.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/blockchain/pallets/ddcclusters.go b/blockchain/pallets/ddcclusters.go index 17eb67a..777e033 100644 --- a/blockchain/pallets/ddcclusters.go +++ b/blockchain/pallets/ddcclusters.go @@ -9,11 +9,12 @@ import ( ) type Cluster struct { - ClusterId ClusterId - ManagerId types.AccountID - ReserveId types.AccountID - Props ClusterProps - Status ClusterStatus + ClusterId ClusterId + ManagerId types.AccountID + ReserveId types.AccountID + Props ClusterProps + Status ClusterStatus + LastValidatedEraId DdcEra } type ClusterProps struct { From 2083b74743e1e340e11ea2566edc7c377f3bec84 Mon Sep 17 00:00:00 2001 From: "Alisher A. Khassanov" Date: Thu, 8 Aug 2024 15:14:34 +0500 Subject: [PATCH 4/4] Add `DAC` variant to `StorageNodeMode` type --- blockchain/pallets/primitives.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/blockchain/pallets/primitives.go b/blockchain/pallets/primitives.go index 83a9d62..f521a4d 100644 --- a/blockchain/pallets/primitives.go +++ b/blockchain/pallets/primitives.go @@ -79,6 +79,7 @@ type StorageNodeMode struct { IsFull bool IsStorage bool IsCache bool + IsDac bool } func (m *StorageNodeMode) Decode(decoder scale.Decoder) error { @@ -94,6 +95,8 @@ func (m *StorageNodeMode) Decode(decoder scale.Decoder) error { m.IsStorage = true } else if b == 3 { m.IsCache = true + } else if b == 4 { + m.IsDac = true } else { return ErrUnknownVariant } @@ -109,6 +112,8 @@ func (m StorageNodeMode) Encode(encoder scale.Encoder) error { err = encoder.PushByte(2) } else if m.IsCache { err = encoder.PushByte(3) + } else if m.IsDac { + err = encoder.PushByte(4) } else { return ErrUnknownVariant }