blobcache

package
v0.0.0-...-49942cb Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPinSetExists   = errors.New("pinset exists")
	ErrPinSetNotFound = errors.New("pinset not found")
)

Functions

This section is empty.

Types

type API

type API interface {
	// PinSets
	CreatePinSet(ctx context.Context, name string) (PinSetID, error)
	DeletePinSet(ctx context.Context, pinset PinSetID) error
	GetPinSet(ctx context.Context, pinset PinSetID) (*PinSet, error)
	Pin(ctx context.Context, pinset PinSetID, mh []byte) error
	Unpin(ctx context.Context, pinset PinSetID, mh []byte) error

	// Blobs
	Post(ctx context.Context, pinset PinSetID, data []byte) ([]byte, error)
	GetF(ctx context.Context, mh []byte, f func([]byte) error) error

	MaxBlobSize() int
}

type Node

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

func NewNode

func NewNode(params Params) *Node

func (*Node) CreatePinSet

func (n *Node) CreatePinSet(ctx context.Context, name string) (PinSetID, error)

func (*Node) DeletePinSet

func (n *Node) DeletePinSet(ctx context.Context, pinset PinSetID) error

func (*Node) GetF

func (n *Node) GetF(ctx context.Context, mh []byte, fn func([]byte) error) error

func (*Node) GetPinSet

func (n *Node) GetPinSet(ctx context.Context, pinset PinSetID) (*PinSet, error)

func (*Node) MaxBlobSize

func (n *Node) MaxBlobSize() int

func (*Node) Pin

func (n *Node) Pin(ctx context.Context, pinset PinSetID, mh []byte) error

func (*Node) Post

func (n *Node) Post(ctx context.Context, pinset PinSetID, data []byte) ([]byte, error)

func (*Node) Shutdown

func (n *Node) Shutdown() error

func (*Node) Unpin

func (n *Node) Unpin(ctx context.Context, pinset PinSetID, mh []byte) error

type Params

type Params struct {
	Ephemeral  bcstate.TxDB
	Persistent bcstate.TxDB

	Mux        simplemux.Muxer
	PrivateKey p2p.PrivateKey
	PeerStore  peers.PeerStore

	ExternalSources []blobs.Getter
}

type PinSet

type PinSet struct {
	ID    PinSetID `json:"id"`
	Name  string   `json:"name"`
	Root  blobs.ID `json:"root"`
	Count uint64   `json:"count"`
}

type PinSetID

type PinSetID int64

type PinSetStore

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

func NewPinSetStore

func NewPinSetStore(db bcstate.TxDB) *PinSetStore

func (*PinSetStore) Create

func (s *PinSetStore) Create(ctx context.Context, name string) (PinSetID, error)

func (*PinSetStore) Delete

func (s *PinSetStore) Delete(ctx context.Context, id PinSetID) error

func (*PinSetStore) Exists

func (s *PinSetStore) Exists(ctx context.Context, id blobs.ID) (bool, error)

func (*PinSetStore) Get

func (s *PinSetStore) Get(ctx context.Context, id PinSetID) (*PinSet, error)

func (*PinSetStore) List

func (s *PinSetStore) List(ctx context.Context, prefix []byte, ids []blobs.ID) (n int, err error)

func (*PinSetStore) Pin

func (s *PinSetStore) Pin(ctx context.Context, psID PinSetID, id blobs.ID) error

func (*PinSetStore) Unpin

func (s *PinSetStore) Unpin(ctx context.Context, psID PinSetID, id blobs.ID) error

Jump to

Keyboard shortcuts

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