Documentation ¶
Index ¶
- Variables
- func CopyBlocks(ctx context.Context, id cid.Cid, src, dst Store) (err error)
- func LoadNode(ctx context.Context, store Store, name string, id cid.Cid, key Key) (privateNode, error)
- func Merge(ctx context.Context, aNode, bNode base.Node) (result base.MergeResult, err error)
- func MergeHAMTBlocks(ctx context.Context, src, dst Store) error
- type BareNamefilter
- type CborByteArray
- type DecryptionStore
- type File
- func (pf *File) AsHistoryEntry() base.HistoryEntry
- func (pf *File) BareNamefilter() BareNamefilter
- func (pf *File) Cid() cid.Cid
- func (pf *File) Close() error
- func (pf *File) Content() cid.Cid
- func (pf *File) History(ctx context.Context, maxRevs int) ([]base.HistoryEntry, error)
- func (pf *File) INumber() INumber
- func (pf *File) IsDir() bool
- func (pf *File) Key() Key
- func (pf *File) Metadata() (f base.LDFile, err error)
- func (pf *File) ModTime() time.Time
- func (pf *File) Mode() fs.FileMode
- func (pf *File) Name() string
- func (pf *File) PrivateFS() Store
- func (pf *File) PrivateName() (Name, error)
- func (pf *File) Put() (PutResult, error)
- func (pf *File) Ratchet() *ratchet.Spiral
- func (pf *File) Read(p []byte) (n int, err error)
- func (pf *File) SetContents(f fs.File)
- func (pf *File) SetMetadata(md interface{}) (err error)
- func (pf *File) Size() int64
- func (pf *File) Stat() (fs.FileInfo, error)
- func (pf *File) Sys() interface{}
- func (pf *File) Type() base.NodeType
- func (pf *File) Update(change fs.File) (result PutResult, err error)
- type HAMT
- type Header
- type HeaderInfo
- type INumber
- type Info
- type Key
- type KeyedNameFilter
- type LDFile
- func (df *LDFile) AsHistoryEntry() base.HistoryEntry
- func (df *LDFile) BareNamefilter() BareNamefilter
- func (df *LDFile) Cid() cid.Cid
- func (df *LDFile) Close() error
- func (df *LDFile) Data() (interface{}, error)
- func (df *LDFile) History(ctx context.Context, maxRevs int) ([]base.HistoryEntry, error)
- func (df *LDFile) INumber() INumber
- func (df *LDFile) IsBare() bool
- func (df *LDFile) IsDir() bool
- func (df *LDFile) Links() base.Links
- func (df *LDFile) Metadata() (base.LDFile, error)
- func (df *LDFile) ModTime() time.Time
- func (df *LDFile) Mode() fs.FileMode
- func (df *LDFile) Name() string
- func (df *LDFile) PrivateName() (Name, error)
- func (df *LDFile) Put() (result PutResult, err error)
- func (df *LDFile) Ratchet() *ratchet.Spiral
- func (df *LDFile) Read(p []byte) (n int, err error)
- func (df *LDFile) ReadDir(n int) ([]fs.DirEntry, error)
- func (df *LDFile) SetContents(data interface{})
- func (df *LDFile) Size() int64
- func (df *LDFile) Stat() (fs.FileInfo, error)
- func (df *LDFile) Sys() interface{}
- func (df *LDFile) Type() base.NodeType
- func (df *LDFile) Update(change fs.File) (result PutResult, err error)
- type Name
- type PrivateLink
- type PrivateLinks
- type PutResult
- type Root
- func (r *Root) Add(path base.Path, f fs.File) (res base.PutResult, err error)
- func (r *Root) Cid() cid.Cid
- func (r *Root) Context() context.Context
- func (r *Root) Copy(path base.Path, srcPathStr string, srcFS fs.FS) (res base.PutResult, err error)
- func (r *Root) HAMTCid() *cid.Cid
- func (r *Root) Mkdir(path base.Path) (res base.PutResult, err error)
- func (r *Root) Open(pathStr string) (fs.File, error)
- func (r *Root) Put() (base.PutResult, error)
- func (r *Root) Rm(path base.Path) (base.PutResult, error)
- type Store
- type Tree
- func (pt *Tree) Add(path base.Path, f fs.File) (res base.PutResult, err error)
- func (pt *Tree) AsHistoryEntry() base.HistoryEntry
- func (pt *Tree) BareNamefilter() BareNamefilter
- func (pt *Tree) Cid() cid.Cid
- func (pt *Tree) Close() error
- func (pt *Tree) Copy(path base.Path, srcPathStr string, srcFS fs.FS) (res base.PutResult, err error)
- func (pt *Tree) Get(path base.Path) (fs.File, error)
- func (pt *Tree) History(ctx context.Context, maxRevs int) ([]base.HistoryEntry, error)
- func (pt *Tree) INumber() INumber
- func (pt *Tree) IsDir() bool
- func (pt *Tree) Key() Key
- func (pt *Tree) Metadata() (f base.LDFile, err error)
- func (pt *Tree) Mkdir(path base.Path) (res base.PutResult, err error)
- func (pt *Tree) ModTime() time.Time
- func (pt *Tree) Mode() fs.FileMode
- func (pt *Tree) Name() string
- func (pt *Tree) PrivateFS() Store
- func (pt *Tree) PrivateName() (Name, error)
- func (pt *Tree) Put() (base.PutResult, error)
- func (pt *Tree) Ratchet() *ratchet.Spiral
- func (pt *Tree) Read(p []byte) (n int, err error)
- func (pt *Tree) ReadDir(n int) ([]fs.DirEntry, error)
- func (pt *Tree) Rm(path base.Path) (base.PutResult, error)
- func (pt *Tree) SetMetadata(md interface{}) (err error)
- func (pt *Tree) Size() int64
- func (pt *Tree) Stat() (fs.FileInfo, error)
- func (pt *Tree) Sys() interface{}
- func (pt *Tree) Type() base.NodeType
- func (pt *Tree) Update(file fs.File) (PutResult, error)
- type WritableDecryptionStore
Constants ¶
This section is empty.
Variables ¶
View Source
var EmptyKey = Key([32]byte{})
Functions ¶
func CopyBlocks ¶
Copy blocks from src to dst
Types ¶
type BareNamefilter ¶
type BareNamefilter string
a name filter with just inumbers in it
func AddToBare ¶
func AddToBare(bareFilter BareNamefilter, toAdd []byte) (BareNamefilter, error)
add some string to a name filter
func CreateBare ¶
func CreateBare(key Key) (BareNamefilter, error)
create bare name filter with a single key
func IdentityBareNamefilter ¶
func IdentityBareNamefilter() BareNamefilter
root key should be the identity bare name filter
func NewBareNamefilter ¶
func NewBareNamefilter(parent BareNamefilter, in INumber) (bnf BareNamefilter, err error)
parent is the "super" constructor arg
type CborByteArray ¶
type CborByteArray []byte
A CBOR-marshalable byte array.
func (*CborByteArray) MarshalCBOR ¶
func (c *CborByteArray) MarshalCBOR(w io.Writer) error
func (*CborByteArray) UnmarshalCBOR ¶
func (c *CborByteArray) UnmarshalCBOR(r io.Reader) error
type DecryptionStore ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
func NewFileMetadata ¶
func (*File) AsHistoryEntry ¶
func (pf *File) AsHistoryEntry() base.HistoryEntry
func (*File) BareNamefilter ¶
func (pf *File) BareNamefilter() BareNamefilter
func (*File) PrivateName ¶
func (*File) SetContents ¶
func (*File) SetMetadata ¶
type HAMT ¶
type HAMT struct {
// contains filtered or unexported fields
}
func LoadHAMT ¶
func LoadHAMT(ctx context.Context, bstore blockstore.Blockstore, id cid.Cid) (*HAMT, error)
func NewEmptyHamt ¶
func NewEmptyHamt(bstore blockstore.Blockstore) (*HAMT, error)
type Header ¶
type Header struct { Info HeaderInfo Metadata cid.Cid ContentID cid.Cid Value interface{} // only present on LDFile nodes }
type HeaderInfo ¶
type HeaderInfo struct { WNFS base.SemVer Type base.NodeType Mode uint32 Ctime int64 Mtime int64 Size int64 INumber INumber BareNamefilter BareNamefilter Ratchet string }
func HeaderInfoFromCBOR ¶
func HeaderInfoFromCBOR(d []byte) (HeaderInfo, error)
func NewHeaderInfo ¶
func NewHeaderInfo(nt base.NodeType, in INumber, bnf BareNamefilter) HeaderInfo
func (HeaderInfo) Copy ¶
func (hi HeaderInfo) Copy() HeaderInfo
type KeyedNameFilter ¶
type KeyedNameFilter string
a name filter with inumbers and a key, which serves as the revision identifier
func AddKey ¶
func AddKey(bareFilter BareNamefilter, key Key) (knf KeyedNameFilter, err error)
add the revision number to the name filter, salted with the AES key for the node
type LDFile ¶
type LDFile struct {
// contains filtered or unexported fields
}
func LoadLDFile ¶
func NewLDFile ¶
func NewLDFile(store Store, name string, content interface{}, parent BareNamefilter) (*LDFile, error)
func (*LDFile) AsHistoryEntry ¶
func (df *LDFile) AsHistoryEntry() base.HistoryEntry
func (*LDFile) BareNamefilter ¶
func (df *LDFile) BareNamefilter() BareNamefilter
func (*LDFile) PrivateName ¶
func (*LDFile) SetContents ¶
func (df *LDFile) SetContents(data interface{})
type Name ¶
type Name string
a hashed name filter exported as "private.Name", private.Name is in fact a private value, and needs to be kept secret
func ToName ¶
func ToName(knf KeyedNameFilter) (Name, error)
saturate the filter to 320 bits and hash it with sha256 to give the private name that a node will be stored in the MMPT with
type PrivateLinks ¶
type PrivateLinks map[string]PrivateLink
func (PrivateLinks) Add ¶
func (pls PrivateLinks) Add(link PrivateLink)
func (PrivateLinks) Get ¶
func (pls PrivateLinks) Get(name string) *PrivateLink
func (PrivateLinks) Remove ¶
func (pls PrivateLinks) Remove(name string) bool
func (PrivateLinks) SizeSum ¶
func (pls PrivateLinks) SizeSum() (total int64)
func (PrivateLinks) SortedSlice ¶
func (pls PrivateLinks) SortedSlice() []PrivateLink
type PutResult ¶
func (PutResult) ToPrivateLink ¶
func (r PutResult) ToPrivateLink(name string) PrivateLink
type Root ¶
type Root struct { *Tree // contains filtered or unexported fields }
func NewEmptyRoot ¶
type Store ¶
type Store interface { Context() context.Context PutEncryptedFile(f fs.File, key []byte) (PutResult, error) GetEncryptedFile(root cid.Cid, key []byte) (io.ReadCloser, error) HAMT() *HAMT DAGService() ipld.DAGService Blockservice() blockservice.BlockService RatchetStore() ratchet.Store }
func LoadStore ¶
func LoadStore(ctx context.Context, bserv blockservice.BlockService, rs ratchet.Store, hamtCid cid.Cid) (s Store, err error)
func NewStore ¶
func NewStore(ctx context.Context, bserv blockservice.BlockService, rs ratchet.Store) (Store, error)
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
func LoadTreeFromName ¶
func NewEmptyTree ¶
func NewEmptyTree(store Store, parent BareNamefilter, name string) (*Tree, error)
func (*Tree) AsHistoryEntry ¶
func (pt *Tree) AsHistoryEntry() base.HistoryEntry
func (*Tree) BareNamefilter ¶
func (pt *Tree) BareNamefilter() BareNamefilter
func (*Tree) PrivateName ¶
func (*Tree) SetMetadata ¶
type WritableDecryptionStore ¶
type WritableDecryptionStore interface { DecryptionStore PutDecryptionFields(id cid.Cid, sname Name, key Key) error }
func NewDecryptionStore ¶
func NewDecryptionStore(filepath string) (WritableDecryptionStore, error)
Click to show internal directories.
Click to hide internal directories.