MCPcopy Create free account
hub / github.com/ethstorage/es-node / runWriteBlob

Function runWriteBlob

cmd/es-utils/main.go:365–385  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

363}
364
365func runWriteBlob(cmd *cobra.Command, args []string) {
366 setupLogger()
367
368 bs := readInputBytes()
369 blobs := utils.EncodeBlobs(bs)
370 commitments, _, versionedHashes, err := utils.ComputeBlobs(blobs)
371 if err != nil {
372 log.Crit("Compute versioned hash failed", "error", err)
373 } else {
374 log.Info(fmt.Sprintf("Versioned hash is %x and commitment is %x", versionedHashes[0][:], commitments[0][:]))
375 }
376
377 ds := initDataShard()
378
379 err = ds.Write(*kvIdx, blobs[0][:], versionedHashes[0])
380 if err != nil {
381 log.Crit("Write failed", "error", err)
382 }
383 log.Info("Write value", "kvIdx", *kvIdx, "bytes", len(blobs[0][:]))
384
385}
386
387func genBlobAndDump(idx int) [][]byte {
388 saveDir := fmt.Sprintf("%s/%d", *dumpFolder, idx)

Callers

nothing calls this directly

Calls 6

EncodeBlobsFunction · 0.92
ComputeBlobsFunction · 0.92
setupLoggerFunction · 0.85
readInputBytesFunction · 0.85
initDataShardFunction · 0.85
WriteMethod · 0.45

Tested by

no test coverage detected