Skip to content

Commit

Permalink
add bucket status to events (#621)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgao001 authored May 21, 2024
1 parent 1445fd1 commit cc41c38
Show file tree
Hide file tree
Showing 3 changed files with 290 additions and 131 deletions.
8 changes: 8 additions & 0 deletions proto/greenfield/storage/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,8 @@ message EventMigrationBucket {
];
// The id of the destination primary sp
uint32 dst_primary_sp_id = 4;
// status define the status of the bucket.
BucketStatus status = 5;
}

message EventCancelMigrationBucket {
Expand All @@ -528,6 +530,8 @@ message EventCancelMigrationBucket {
(gogoproto.customtype) = "Uint",
(gogoproto.nullable) = false
];
// status define the status of the bucket.
BucketStatus status = 4;
}

message EventRejectMigrateBucket {
Expand All @@ -541,6 +545,8 @@ message EventRejectMigrateBucket {
(gogoproto.customtype) = "Uint",
(gogoproto.nullable) = false
];
// status define the status of the bucket.
BucketStatus status = 4;
}

message EventCompleteMigrationBucket {
Expand All @@ -559,6 +565,8 @@ message EventCompleteMigrationBucket {
uint32 global_virtual_group_family_id = 4;
// The src_primary_sp_id defines the primary sp id of the bucket before migrate.
uint32 src_primary_sp_id = 5;
// status define the status of the bucket.
BucketStatus status = 6;
}

message EventSetTag {
Expand Down
5 changes: 5 additions & 0 deletions x/storage/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"cosmossdk.io/errors"
sdkmath "cosmossdk.io/math"

"github.com/cometbft/cometbft/libs/log"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/store/prefix"
Expand Down Expand Up @@ -2182,6 +2183,7 @@ func (k Keeper) MigrateBucket(ctx sdk.Context, operator sdk.AccAddress, bucketNa
BucketName: bucketName,
BucketId: bucketInfo.Id,
DstPrimarySpId: dstSP.Id,
Status: bucketInfo.BucketStatus,
}); err != nil {
return err
}
Expand Down Expand Up @@ -2264,6 +2266,7 @@ func (k Keeper) CompleteMigrateBucket(ctx sdk.Context, operator sdk.AccAddress,
BucketId: bucketInfo.Id,
GlobalVirtualGroupFamilyId: gvgFamilyID,
SrcPrimarySpId: srcGvgFamily.PrimarySpId,
Status: bucketInfo.BucketStatus,
}); err != nil {
return err
}
Expand Down Expand Up @@ -2310,6 +2313,7 @@ func (k Keeper) CancelBucketMigration(ctx sdk.Context, operator sdk.AccAddress,
Operator: operator.String(),
BucketName: bucketName,
BucketId: bucketInfo.Id,
Status: bucketInfo.BucketStatus,
}); err != nil {
return err
}
Expand Down Expand Up @@ -2344,6 +2348,7 @@ func (k Keeper) RejectBucketMigration(ctx sdk.Context, operator sdk.AccAddress,
Operator: operator.String(),
BucketName: bucketName,
BucketId: bucketInfo.Id,
Status: bucketInfo.BucketStatus,
}); err != nil {
return err
}
Expand Down
Loading

0 comments on commit cc41c38

Please sign in to comment.