imports

package
v1.21.0-rpc-p01-brave Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2023 License: Apache-2.0, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CAROwnerImportMgr = "importmgr"
	CAROwnerUser      = "user"
)
View Source
const (
	LSource   = LabelKey("source")    // Function which created the import
	LRootCid  = LabelKey("root")      // Root CID
	LFileName = LabelKey("filename")  // Local file path of the source file.
	LCARPath  = LabelKey("car_path")  // Path of the CARv2 file containing the imported data.
	LCAROwner = LabelKey("car_owner") // Owner of the CAR; "importmgr" is us; "user" or empty is them.
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ID

type ID uint64

type LabelKey

type LabelKey = string

type LabelValue

type LabelValue = string

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(ds datastore.Batching, rootDir string) *Manager

func (*Manager) AddLabel

func (m *Manager) AddLabel(id ID, key LabelKey, value LabelValue) error

AddLabel adds a label associated with an import, such as the source, car path, CID, etc.

func (*Manager) AllocateCAR

func (m *Manager) AllocateCAR(id ID) (path string, err error)

AllocateCAR creates a new CAR allocated to the supplied import under the root directory.

func (*Manager) CARPathFor

func (m *Manager) CARPathFor(dagRoot cid.Cid) (string, error)

func (*Manager) CreateImport

func (m *Manager) CreateImport() (id ID, err error)

CreateImport initializes a new import, returning its ID and optionally a CAR path where to place the data, if requested.

func (*Manager) Info

func (m *Manager) Info(id ID) (*Meta, error)

Info returns the metadata known to this store for the specified import ID.

func (*Manager) List

func (m *Manager) List() ([]ID, error)

List returns all import IDs known by this Manager.

func (*Manager) Remove

func (m *Manager) Remove(id ID) error

Remove drops all data associated with the supplied import ID.

type Meta

type Meta struct {
	Labels map[LabelKey]LabelValue
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL