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

Function AddDataShardFromConfig

ethstorage/shard_config.go:60–84  ·  view source on GitHub ↗
(cfg string)

Source from the content-addressed store, hash-verified

58}
59
60func AddDataShardFromConfig(cfg string) error {
61 // Format is kvSize,shardIdx
62 ss := strings.Split(cfg, ",")
63 if len(ss) != 2 || len(ss[0]) == 0 || len(ss[1]) == 0 {
64 return fmt.Errorf("incorrect data shard cfg")
65 }
66
67 kvSize, err := parseKvSize(ss[0])
68 if err != nil {
69 return err
70 }
71 var shardIdx uint64
72
73 sm := findShardManaager(kvSize)
74 if sm == nil {
75 return fmt.Errorf("shard with kv size %d not found", kvSize)
76 }
77
78 if v, err := strconv.Atoi(ss[1]); err != nil {
79 return err
80 } else {
81 shardIdx = uint64(v)
82 }
83 return sm.AddDataShard(shardIdx)
84}
85
86func AddDataFileFromConfig(cfg string) error {
87 df, err := OpenDataFile(cfg)

Callers

nothing calls this directly

Calls 3

parseKvSizeFunction · 0.85
findShardManaagerFunction · 0.85
AddDataShardMethod · 0.80

Tested by

no test coverage detected