(df *DataFile)
| 37 | } |
| 38 | |
| 39 | func (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 |
| 58 | func (ds *DataShard) IsComplete() bool { |
no outgoing calls
no test coverage detected