Categorygithub.com/myelnet/go-multistore
modulepackage
0.0.6
Repository: https://github.com/myelnet/go-multistore.git
Documentation: pkg.go.dev

# README

go-multistore

This repository provides a mechanism for constructing multiple, isolated, IPFS storage instances (blockstore, filestore, DAGService) on top of a single go-datastore instance.

Background reading

You may want to familiarize yourself with various IPFS storage layer components:

Installation

go get "github.com/myelnet/go-multistore"`

Usage

Initialize multistore:

var ds datastore.Batching
multiDs, err := multistore.NewMultiDstore(ds)

Create new store:

next := multiDs.Next()
store, err := multiDs.Get(store)

// store will have a blockstore, filestore, and DAGService

List existing store indexes:

indexes := multiDs.List()

Delete a store (will delete all data in isolated store without touching the rest of the datastore):

var index int
err := multiDs.Delete(index)

Shutdown (make sure everything is closed):

multiDs.Close()

# Functions

NewMultiDstore returns a new instance of a MultiStore for the given datastore instance.

# Structs

MultiStore is a wrapper around a datastore that provides multiple isolated instances of IPFS storage components -> BlockStore, FileStore, DAGService, etc.
Store is a single store instance returned by the MultiStore.

# Type aliases

StoreID identifies a unique instance of a store.
StoreIDList is just a list of StoreID that implements sort.Interface.