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

storage keys and size #219

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
12 changes: 12 additions & 0 deletions interfaces/primitives/protocol.proto
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,15 @@ message weight {
uint64 value = 1;
// size 8 bytes
}

message storage_keys {
option inline_type = "uint64";
uint64 value = 1;
// size 8 bytes
}

message storage_size_megabyte {
option inline_type = "uint64";
uint64 value = 1;
// size 8 bytes
}
2 changes: 2 additions & 0 deletions interfaces/services/management.proto
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ message GetSubscriptionStatusInput {

message GetSubscriptionStatusOutput {
bool subscription_status_is_active = 1;
primitives.storage_keys subscription_max_keys = 2;
primitives.storage_size_megabyte subscription_max_size = 3;
}

message GetCommitteeInput {
Expand Down
2 changes: 2 additions & 0 deletions interfaces/services/state_storage.proto
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ message GetLastCommittedBlockInfoOutput {
primitives.node_address block_proposer_address = 3;
primitives.timestamp_seconds current_reference_time = 4;
primitives.timestamp_seconds prev_reference_time = 5;
primitives.storage_keys current_num_keys = 6;
primitives.storage_size_megabyte current_size = 7;
}

message CommitStateDiffInput {
Expand Down
28 changes: 28 additions & 0 deletions types/go/primitives/protocol.mb.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,31 @@ func (x Weight) Equal(y Weight) bool {
func (x Weight) KeyForMap() uint64 {
return uint64(x)
}

type StorageKeys uint64

func (x StorageKeys) String() string {
return fmt.Sprintf("%x", uint64(x))
}

func (x StorageKeys) Equal(y StorageKeys) bool {
return x == y
}

func (x StorageKeys) KeyForMap() uint64 {
return uint64(x)
}

type StorageSizeMegabyte uint64

func (x StorageSizeMegabyte) String() string {
return fmt.Sprintf("%x", uint64(x))
}

func (x StorageSizeMegabyte) Equal(y StorageSizeMegabyte) bool {
return x == y
}

func (x StorageSizeMegabyte) KeyForMap() uint64 {
return uint64(x)
}
14 changes: 13 additions & 1 deletion types/go/services/management.mb.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,20 +162,32 @@ func (x *GetSubscriptionStatusInput) StringReference() (res string) {

type GetSubscriptionStatusOutput struct {
SubscriptionStatusIsActive bool
SubscriptionMaxKeys primitives.StorageKeys
SubscriptionMaxSize primitives.StorageSizeMegabyte
}

func (x *GetSubscriptionStatusOutput) String() string {
if x == nil {
return "<nil>"
}
return fmt.Sprintf("{SubscriptionStatusIsActive:%s,}", x.StringSubscriptionStatusIsActive())
return fmt.Sprintf("{SubscriptionStatusIsActive:%s,SubscriptionMaxKeys:%s,SubscriptionMaxSize:%s,}", x.StringSubscriptionStatusIsActive(), x.StringSubscriptionMaxKeys(), x.StringSubscriptionMaxSize())
}

func (x *GetSubscriptionStatusOutput) StringSubscriptionStatusIsActive() (res string) {
res = fmt.Sprintf("%v", x.SubscriptionStatusIsActive)
return
}

func (x *GetSubscriptionStatusOutput) StringSubscriptionMaxKeys() (res string) {
res = fmt.Sprintf("%s", x.SubscriptionMaxKeys)
return
}

func (x *GetSubscriptionStatusOutput) StringSubscriptionMaxSize() (res string) {
res = fmt.Sprintf("%s", x.SubscriptionMaxSize)
return
}

/////////////////////////////////////////////////////////////////////////////
// message GetCommitteeInput (non serializable)

Expand Down
14 changes: 13 additions & 1 deletion types/go/services/state_storage.mb.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,15 @@ type GetLastCommittedBlockInfoOutput struct {
BlockProposerAddress primitives.NodeAddress
CurrentReferenceTime primitives.TimestampSeconds
PrevReferenceTime primitives.TimestampSeconds
CurrentNumKeys primitives.StorageKeys
CurrentSize primitives.StorageSizeMegabyte
}

func (x *GetLastCommittedBlockInfoOutput) String() string {
if x == nil {
return "<nil>"
}
return fmt.Sprintf("{BlockHeight:%s,BlockTimestamp:%s,BlockProposerAddress:%s,CurrentReferenceTime:%s,PrevReferenceTime:%s,}", x.StringBlockHeight(), x.StringBlockTimestamp(), x.StringBlockProposerAddress(), x.StringCurrentReferenceTime(), x.StringPrevReferenceTime())
return fmt.Sprintf("{BlockHeight:%s,BlockTimestamp:%s,BlockProposerAddress:%s,CurrentReferenceTime:%s,PrevReferenceTime:%s,CurrentNumKeys:%s,CurrentSize:%s,}", x.StringBlockHeight(), x.StringBlockTimestamp(), x.StringBlockProposerAddress(), x.StringCurrentReferenceTime(), x.StringPrevReferenceTime(), x.StringCurrentNumKeys(), x.StringCurrentSize())
}

func (x *GetLastCommittedBlockInfoOutput) StringBlockHeight() (res string) {
Expand Down Expand Up @@ -132,6 +134,16 @@ func (x *GetLastCommittedBlockInfoOutput) StringPrevReferenceTime() (res string)
return
}

func (x *GetLastCommittedBlockInfoOutput) StringCurrentNumKeys() (res string) {
res = fmt.Sprintf("%s", x.CurrentNumKeys)
return
}

func (x *GetLastCommittedBlockInfoOutput) StringCurrentSize() (res string) {
res = fmt.Sprintf("%s", x.CurrentSize)
return
}

/////////////////////////////////////////////////////////////////////////////
// message CommitStateDiffInput (non serializable)

Expand Down