From 247ee831e5eb6d4ca87397ca367fbbddf2c6f6c3 Mon Sep 17 00:00:00 2001 From: Ekaterina Pavlova Date: Thu, 12 Dec 2024 20:03:24 +0300 Subject: [PATCH] cli: change block timestamp attribute of objects in `upload-bin` Close #3654 Signed-off-by: Ekaterina Pavlova --- cli/util/upload_bin.go | 4 +++- docs/neofs-blockstorage.md | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cli/util/upload_bin.go b/cli/util/upload_bin.go index 274bcad31..90dff60c5 100644 --- a/cli/util/upload_bin.go +++ b/cli/util/upload_bin.go @@ -211,7 +211,8 @@ func uploadBlocksAndIndexFiles(ctx *cli.Context, p poolWrapper, rpc *rpcclient.C *object.NewAttribute("Primary", strconv.Itoa(int(blk.PrimaryIndex))), *object.NewAttribute("Hash", blk.Hash().StringLE()), *object.NewAttribute("PrevHash", blk.PrevHash.StringLE()), - *object.NewAttribute("Timestamp", strconv.FormatUint(blk.Timestamp, 10)), + *object.NewAttribute("BlockTime", strconv.FormatUint(blk.Timestamp, 10)), + *object.NewAttribute("Timestamp", strconv.FormatInt(time.Now().Unix(), 10)), } var ( @@ -263,6 +264,7 @@ func uploadBlocksAndIndexFiles(ctx *cli.Context, p poolWrapper, rpc *rpcclient.C attrs := []object.Attribute{ *object.NewAttribute(indexAttributeKey, strconv.Itoa(int(indexFileStart/indexFileSize))), *object.NewAttribute("IndexSize", strconv.Itoa(int(indexFileSize))), + *object.NewAttribute("Timestamp", strconv.FormatInt(time.Now().Unix(), 10)), } err := retry(func() error { var errUpload error diff --git a/docs/neofs-blockstorage.md b/docs/neofs-blockstorage.md index fe71b233e..f1115d95e 100644 --- a/docs/neofs-blockstorage.md +++ b/docs/neofs-blockstorage.md @@ -16,13 +16,15 @@ form as a separate object with a unique OID and a set of attributes: - primary node index (`Primary:0`) - block hash in the LE form (`Hash:5412a781caf278c0736556c0e544c7cfdbb6e3c62ae221ef53646be89364566b`) - previous block hash in the LE form (`PrevHash:3654a054d82a8178c7dfacecc2c57282e23468a42ee407f14506368afe22d929`) - - millisecond-precision block timestamp (`Timestamp:1627894840919`) + - millisecond-precision block creation timestamp (`BlockTime:1627894840919`) + - second-precision block uploading timestamp (`Timestamp:1627894840`) Each index file is an object containing a constant-sized batch of raw block object IDs in binary form ordered by block index. Each index file is marked with the following attributes: - index file identifier with consecutive file index value (`Index:0`) - the number of OIDs included into index file (`IndexSize:128000`) + - second-precision index file uploading timestamp (`Timestamp:1627894840`) ### NeoFS BlockFetcher