cli: change block timestamp attribute of objects in upload-bin

Close #3654

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
This commit is contained in:
Ekaterina Pavlova 2024-12-12 20:03:24 +03:00
parent e0c8bebd05
commit 247ee831e5
2 changed files with 6 additions and 2 deletions

View file

@ -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

View file

@ -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