public

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllKeys

func AllKeys(ctx context.Context, bs blockstore.Blockstore) ([]cid.Cid, error)

func CopyBlocks

func CopyBlocks(ctx context.Context, id cid.Cid, src, dst Store) error

Copy blocks from src to dst

func Merge

func Merge(ctx context.Context, a, b base.Node) (result base.MergeResult, err error)

func WrapFileMetadata

func WrapFileMetadata(f fs.File, meta interface{}) (wrapped fs.File)

Types

type File

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

func LoadFile

func LoadFile(ctx context.Context, store Store, name string, id cid.Cid) (*File, error)

func NewFile

func NewFile(store Store, name string, content io.ReadCloser) (*File, error)

func NewFileMetadata

func NewFileMetadata(store Store, name string, content io.ReadCloser, meta interface{}) (*File, error)

func (*File) AsHistoryEntry

func (f *File) AsHistoryEntry() base.HistoryEntry

func (*File) Cid

func (f *File) Cid() cid.Cid

func (*File) Close

func (f *File) Close() error

func (*File) History

func (f *File) History(ctx context.Context, maxRevs int) ([]base.HistoryEntry, error)

func (*File) IsDir

func (f *File) IsDir() bool
func (f *File) Links() base.Links

func (*File) Metadata

func (f *File) Metadata() (res base.LDFile, err error)

func (*File) ModTime

func (f *File) ModTime() time.Time

func (*File) Mode

func (f *File) Mode() fs.FileMode

func (*File) Name

func (f *File) Name() string

func (*File) Put

func (f *File) Put() (base.PutResult, error)

func (*File) Read

func (f *File) Read(p []byte) (n int, err error)

func (*File) SetFile

func (f *File) SetFile(r io.ReadCloser)

func (*File) SetMetadata

func (f *File) SetMetadata(v interface{}) error

func (*File) Size

func (f *File) Size() int64

func (*File) Stat

func (f *File) Stat() (fs.FileInfo, error)

func (*File) Sys

func (f *File) Sys() interface{}

func (*File) Type

func (f *File) Type() base.NodeType

type FileGetter

type FileGetter interface {
	GetFile(context.Context, cid.Cid) (io.ReadCloser, error)
}
type Header struct {
	Info     *Info
	Previous *cid.Cid // historical backpointer
	Merge    *cid.Cid // if this version is a merge, will be populated
	Metadata *cid.Cid
	Skeleton *cid.Cid // only present on directories
	Userland *cid.Cid
}

type Info

type Info struct {
	WNFS  base.SemVer   `json:"wnfs"`
	Type  base.NodeType `json:"type"`
	Mode  uint32        `json:"mode"`
	Ctime int64         `json:"ctime"`
	Mtime int64         `json:"mtime"`
	Size  int64         `json:"size"`
}

func InfoFromMap

func InfoFromMap(m map[string]interface{}) *Info

func NewInfo

func NewInfo(t base.NodeType) *Info

func (*Info) Map

func (i *Info) Map() map[string]interface{}

type LDFile

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

func LoadLDFile

func LoadLDFile(ctx context.Context, store Store, name string, id cid.Cid) (*LDFile, error)

func NewBareLDFile

func NewBareLDFile(store Store, name string, content interface{}) *LDFile

func NewLDFile

func NewLDFile(store Store, name string, content interface{}) *LDFile

func (*LDFile) AsHistoryEntry

func (df *LDFile) AsHistoryEntry() base.HistoryEntry

func (*LDFile) Cid

func (df *LDFile) Cid() cid.Cid

func (*LDFile) Close

func (df *LDFile) Close() error

func (*LDFile) Data

func (df *LDFile) Data() (interface{}, error)

func (*LDFile) History

func (df *LDFile) History(ctx context.Context, maxRevs int) ([]base.HistoryEntry, error)

func (*LDFile) IsBare

func (df *LDFile) IsBare() bool

func (*LDFile) IsDir

func (df *LDFile) IsDir() bool
func (df *LDFile) Links() base.Links

func (*LDFile) Metadata

func (df *LDFile) Metadata() (base.LDFile, error)

func (*LDFile) ModTime

func (df *LDFile) ModTime() time.Time

func (*LDFile) Mode

func (df *LDFile) Mode() fs.FileMode

func (*LDFile) Name

func (df *LDFile) Name() string

func (*LDFile) Put

func (df *LDFile) Put() (result base.PutResult, err error)

func (*LDFile) Read

func (df *LDFile) Read(p []byte) (n int, err error)

func (*LDFile) ReadDir

func (df *LDFile) ReadDir(n int) ([]fs.DirEntry, error)

func (*LDFile) SetFile

func (df *LDFile) SetFile(data interface{})

func (*LDFile) SetMetadata

func (df *LDFile) SetMetadata(m interface{}) error

func (*LDFile) Size

func (df *LDFile) Size() int64

func (*LDFile) Stat

func (df *LDFile) Stat() (fs.FileInfo, error)

func (*LDFile) Sys

func (df *LDFile) Sys() interface{}

func (*LDFile) Type

func (df *LDFile) Type() base.NodeType

type PutResult

type PutResult struct {
	Cid      cid.Cid
	Size     int64
	Type     base.NodeType
	Userland cid.Cid
	Metadata cid.Cid
	Skeleton Skeleton
}

func (PutResult) CID

func (r PutResult) CID() cid.Cid
func (r PutResult) ToLink(name string) base.Link

func (PutResult) ToSkeletonInfo

func (r PutResult) ToSkeletonInfo() SkeletonInfo

type Skeleton

type Skeleton map[string]SkeletonInfo

func LoadSkeleton

func LoadSkeleton(ctx context.Context, store FileGetter, id cid.Cid) (Skeleton, error)

func (Skeleton) CBORFile

func (s Skeleton) CBORFile() (fs.File, error)

func (Skeleton) PathInfo

func (s Skeleton) PathInfo(path base.Path) (SkeletonInfo, error)

type SkeletonInfo

type SkeletonInfo struct {
	Cid         cid.Cid  `json:"cid,omitempty"`
	Userland    cid.Cid  `json:"userland,omitempty"`
	Metadata    cid.Cid  `json:"metadata,omitempty"`
	SubSkeleton Skeleton `json:"subSkeleton,omitempty"`
	IsFile      bool     `json:"isFile"`
}

type SkeletonSource

type SkeletonSource interface {
	Skeleton() (Skeleton, error)
}

type Store

type Store interface {
	Context() context.Context
	Blockservice() blockservice.BlockService
	GetFile(ctx context.Context, root cid.Cid) (io.ReadCloser, error)
	PutFile(f fs.File) (PutResult, error)
}

Store is a store of Content-Addressed block data indexed by merkle proofs. It's an abstraction over IPFS that defines the required feature set to run wnfs

func NewStore

func NewStore(ctx context.Context, bserv blockservice.BlockService) Store

func NodeStore

func NodeStore(n base.Node) (Store, error)

type Tree

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

func LoadTree

func LoadTree(ctx context.Context, st Store, name string, id cid.Cid) (*Tree, error)

func NewEmptyTree

func NewEmptyTree(store Store, name string) *Tree

func (*Tree) Add

func (t *Tree) Add(path base.Path, f fs.File) (res base.PutResult, err error)

func (*Tree) AsHistoryEntry

func (t *Tree) AsHistoryEntry() base.HistoryEntry

func (*Tree) Cid

func (t *Tree) Cid() cid.Cid

func (*Tree) Close

func (t *Tree) Close() error

func (*Tree) Copy

func (t *Tree) Copy(path base.Path, srcPathStr string, srcFS fs.FS) (res base.PutResult, err error)

func (*Tree) Get

func (t *Tree) Get(path base.Path) (fs.File, error)

func (*Tree) History

func (t *Tree) History(ctx context.Context, max int) ([]base.HistoryEntry, error)

func (*Tree) IsDir

func (t *Tree) IsDir() bool
func (t *Tree) Links() base.Links

func (*Tree) Metadata

func (t *Tree) Metadata() (f base.LDFile, err error)

func (*Tree) Mkdir

func (t *Tree) Mkdir(path base.Path) (res base.PutResult, err error)

func (*Tree) ModTime

func (t *Tree) ModTime() time.Time

func (*Tree) Mode

func (t *Tree) Mode() fs.FileMode

func (*Tree) Name

func (t *Tree) Name() string

func (*Tree) Put

func (t *Tree) Put() (base.PutResult, error)

func (*Tree) Raw

func (t *Tree) Raw() []byte

func (*Tree) Read

func (t *Tree) Read(p []byte) (n int, err error)

func (*Tree) ReadDir

func (t *Tree) ReadDir(n int) ([]fs.DirEntry, error)

func (*Tree) Rm

func (t *Tree) Rm(path base.Path) (base.PutResult, error)

func (*Tree) SetMetadata

func (t *Tree) SetMetadata(md interface{}) error

func (*Tree) Size

func (t *Tree) Size() int64

func (*Tree) Skeleton

func (t *Tree) Skeleton() (Skeleton, error)

func (*Tree) Stat

func (t *Tree) Stat() (fs.FileInfo, error)

func (*Tree) Sys

func (t *Tree) Sys() interface{}

func (*Tree) Type

func (t *Tree) Type() base.NodeType

Jump to

Keyboard shortcuts

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