Documentation ¶
Overview ¶
package mg11 contains the code to perform 11-12 repository migration in go-ipfs. This performs a switch to raw multihashes for all keys in the go-ipfs datastore (https://github.com/ipfs/go-ipfs/issues/6815).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var EnableFlatFSFastPath bool = true
var NWorkers int = 1
NWorkers sets the number of swapping threads to run when applying a migration.
var SyncSize uint64 = 100 * 1024 * 1024 // 100MiB
SyncSize specifies how much we batch data before committing and syncing.
Functions ¶
Types ¶
type CidSwapper ¶
type CidSwapper struct { Prefix ds.Key // A prefix/namespace to limit the query. Store ds.Batching // the datastore to migrate. SwapCh chan Swap // a channel that gets notified for every swap }
CidSwapper reads all the keys in a datastore and replaces them with their raw multihash.
func (*CidSwapper) Prepare ¶ added in v1.0.2
func (cswap *CidSwapper) Prepare() (uint64, error)
Prepare performs a dry run without copying anything but notifying SwapCh as it runs.
Retruns the total number of keys swapped.
type Migration ¶
type Migration struct {
// contains filtered or unexported fields
}
Migration implements the migration described above.
func (*Migration) Apply ¶
Apply runs the migration and writes a log file that can be used by Revert. Steps:
- Open a raw datastore using go-ipfs settings
- Simulate the migration and save a backup log
- Run the migration by storing all CIDv1 addressed logs as raw-multihash addressed.
func (*Migration) Revert ¶
Revert attempts to undo the migration using the log file written by Apply. Steps: - Read the backup log and write all entries as a CIDv1-addressed block - Do the same with the MFS root - Do the same with all the CidV1 blocks recursively referenced in the pinset
Revert does not delete blocks that are reverted so cover some corner cases.