Skip to content

Commit

Permalink
chore: add lvg id to related events (#490)
Browse files Browse the repository at this point in the history
  • Loading branch information
forcodedancing authored Sep 22, 2023
1 parent 908cae8 commit 014b759
Show file tree
Hide file tree
Showing 3 changed files with 206 additions and 125 deletions.
4 changes: 4 additions & 0 deletions proto/greenfield/storage/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ message EventCreateObject {
SourceType source_type = 15;
// checksums define the total checksums of the object which generated by redundancy
repeated bytes checksums = 16;
// local_virtual_group_id defines the unique id of lvg which the object stored
uint32 local_virtual_group_id = 17;
}

// EventCancelCreateObject is emitted on MsgCancelCreateObject
Expand Down Expand Up @@ -201,6 +203,8 @@ message EventCopyObject {
(gogoproto.customtype) = "Uint",
(gogoproto.nullable) = false
];
// local_virtual_group_id defines the unique id of lvg which the object stored
uint32 local_virtual_group_id = 8;
}

// EventDeleteObject is emitted on MsgDeleteObject
Expand Down
46 changes: 24 additions & 22 deletions x/storage/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -637,21 +637,22 @@ func (k Keeper) CreateObject(
store.Set(types.GetObjectByIDKey(objectInfo.Id), obz)

if err = ctx.EventManager().EmitTypedEvents(&types.EventCreateObject{
Creator: operator.String(),
Owner: objectInfo.Owner,
BucketName: bucketInfo.BucketName,
ObjectName: objectInfo.ObjectName,
BucketId: bucketInfo.Id,
ObjectId: objectInfo.Id,
CreateAt: objectInfo.CreateAt,
PayloadSize: objectInfo.PayloadSize,
Visibility: objectInfo.Visibility,
PrimarySpId: sp.Id,
ContentType: objectInfo.ContentType,
Status: objectInfo.ObjectStatus,
RedundancyType: objectInfo.RedundancyType,
SourceType: objectInfo.SourceType,
Checksums: objectInfo.Checksums,
Creator: operator.String(),
Owner: objectInfo.Owner,
BucketName: bucketInfo.BucketName,
ObjectName: objectInfo.ObjectName,
BucketId: bucketInfo.Id,
ObjectId: objectInfo.Id,
CreateAt: objectInfo.CreateAt,
PayloadSize: objectInfo.PayloadSize,
Visibility: objectInfo.Visibility,
PrimarySpId: sp.Id,
ContentType: objectInfo.ContentType,
Status: objectInfo.ObjectStatus,
RedundancyType: objectInfo.RedundancyType,
SourceType: objectInfo.SourceType,
Checksums: objectInfo.Checksums,
LocalVirtualGroupId: objectInfo.LocalVirtualGroupId,
}); err != nil {
return objectInfo.Id, err
}
Expand Down Expand Up @@ -1071,13 +1072,14 @@ func (k Keeper) CopyObject(
store.Set(types.GetObjectByIDKey(objectInfo.Id), obz)

if err := ctx.EventManager().EmitTypedEvents(&types.EventCopyObject{
Operator: operator.String(),
SrcBucketName: srcObjectInfo.BucketName,
SrcObjectName: srcObjectInfo.ObjectName,
DstBucketName: objectInfo.BucketName,
DstObjectName: objectInfo.ObjectName,
SrcObjectId: srcObjectInfo.Id,
DstObjectId: objectInfo.Id,
Operator: operator.String(),
SrcBucketName: srcObjectInfo.BucketName,
SrcObjectName: srcObjectInfo.ObjectName,
DstBucketName: objectInfo.BucketName,
DstObjectName: objectInfo.ObjectName,
SrcObjectId: srcObjectInfo.Id,
DstObjectId: objectInfo.Id,
LocalVirtualGroupId: objectInfo.LocalVirtualGroupId,
}); err != nil {
return sdkmath.ZeroUint(), err
}
Expand Down
Loading

0 comments on commit 014b759

Please sign in to comment.