Sector Key - "original" replica

Not sure when the cache paths are needed but I will figure it out.

Workflows

Adding data to an existing replica

EncodeInto(newReplicaPath, newCachePath, sectorKeyPath, sectorKeyCachePath, stagedDataPath, pieces []abi.PieceInfo, CommSectorKey) NewCommR, NewCommD

Encodes the stagedData into sectorKey and writes it to newReplicaPath by generating CommD from PieceInfos and running the encoding process. Returns the new CommR

newReplica[i] = sectorKey[i] + data[i] * rand(i)
NewCommR = Comm(newReplica)

This is the core workflow of the protocol.

Extracting data from existing replica and sector key

DecodeFrom(outDataPath, replicaPath, sectorKeyPath, sectorKeyCache, CommD, CommR, CommSectorKey)

Runs decoding process by generating encoding randomness from CommD and CommR and writing the result into outDataPath.

data[i] = (replica[i] - sectorKey[i]) * (rand(i)^-1)

This will be probably used very little but still useful.

(TODO API call for generating sector key).

Decoding replica into sector key by use of deal data

RemoveData[different name](sectorKeyPath, sectorKeyCache, replicaPath, replicaCachePath, dataPath, CommD, CommR, CommSectorKey)

Removes encoded data and produces SectorKey

sectorKey[i] = replica[i] - data[i] * rand(i)

Encoding new data into sector with data without explicit sector key