Skip to content

Commit

Permalink
cli: change block timestamp attribute of objects in upload-bin
Browse files Browse the repository at this point in the history
Close #3654

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
  • Loading branch information
AliceInHunterland committed Dec 13, 2024
1 parent 38f635b commit 3cc6ba3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cli/util/upload_bin.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,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 (
Expand Down Expand Up @@ -260,6 +261,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
Expand Down
4 changes: 3 additions & 1 deletion docs/neofs-blockstorage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3cc6ba3

Please sign in to comment.