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

Method AddDataFile

ethstorage/data_shard.go:39–55  ·  view source on GitHub ↗
(df *DataFile)

Source from the content-addressed store, hash-verified

37}
38
39func (ds *DataShard) AddDataFile(df *DataFile) error {
40 if len(ds.dataFiles) != 0 {
41 // Perform sanity check
42 if ds.dataFiles[0].miner != df.miner {
43 return fmt.Errorf("mismatched data file SP")
44 }
45 if ds.dataFiles[0].encodeType != df.encodeType {
46 return fmt.Errorf("mismatched data file encode type")
47 }
48 if ds.dataFiles[0].maxKvSize != df.maxKvSize {
49 return fmt.Errorf("mismatched data file max kv size")
50 }
51 // TODO: May check if not overlapped?
52 }
53 ds.dataFiles = append(ds.dataFiles, df)
54 return nil
55}
56
57// Returns whether the shard has all data files to cover all entries
58func (ds *DataShard) IsComplete() bool {

Callers 4

AddDataFileMethod · 0.95
AddDataFileAndShardMethod · 0.95
initDataShardFunction · 0.95
AddDataFileFromConfigFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected