Documentation
¶
Index ¶
- Variables
- func AddAndPinNodes(ctx context.Context, ipfs iface.CoreAPI, nodes []ipld.Node) (context.Context, error)
- func AddPinnedBytes(ctx context.Context, delta int64) context.Context
- func CopyDag(ctx context.Context, ipfs iface.CoreAPI, buck *collection.Bucket, ...) (context.Context, path.Resolved, error)
- func CreateBucketPath(ctx context.Context, ipfs iface.CoreAPI, seed ipld.Node, key []byte) (context.Context, path.Resolved, error)
- func CreateBucketPathWithCid(ctx context.Context, ipfs iface.CoreAPI, buckPath string, cid cid.Cid, ...) (context.Context, path.Resolved, error)
- func DecryptData(data, key []byte) ([]byte, error)
- func DecryptNode(cn ipld.Node, key []byte) (ipld.Node, bool, error)
- func EncryptDag(ctx context.Context, ipfs iface.CoreAPI, root ipld.Node, destPath string, ...) (map[cid.Cid]*NamedNode, error)
- func EncryptData(data, currentKey, newKey []byte) ([]byte, error)
- func EncryptFileNode(ctx context.Context, ipfs iface.CoreAPI, n ipld.Node, ...) (ipld.Node, error)
- func EncryptNode(n *mdag.ProtoNode, key []byte) (*mdag.ProtoNode, error)
- func GetNodeAtPath(ctx context.Context, ipfs iface.CoreAPI, pth path.Path, key []byte) (ipld.Node, error)
- func GetPathSize(ctx context.Context, ipfs iface.CoreAPI, root path.Path) (int64, error)
- func GetPinnedBytes(ctx context.Context) int64
- func InsertNodeAtPath(ctx context.Context, ipfs iface.CoreAPI, child ipld.Node, pth path.Path, ...) (context.Context, path.Resolved, error)
- func MakeBucketSeed(key []byte) (ipld.Node, error)
- func NewDirFromExistingPath(ctx context.Context, ipfs iface.CoreAPI, pth path.Path, destPath string, ...) (ipld.Node, []ipld.Node, error)
- func NewOwnerContext(ctx context.Context, owner *BucketOwner) context.Context
- func NewResolvedPath(s string) (path.Resolved, error)
- func ParsePath(p path.Path) (resolved path.Resolved, fpath string, err error)
- func PinBlocks(ctx context.Context, ipfs iface.CoreAPI, nodes []ipld.Node) (context.Context, error)
- func RemoveNodeAtPath(ctx context.Context, ipfs iface.CoreAPI, pth path.Path, key []byte) (context.Context, path.Resolved, error)
- func ResolveNodeAtPath(ctx context.Context, ipfs iface.CoreAPI, pth path.Resolved, key []byte) (ipld.Node, bool, error)
- func UnpinBranch(ctx context.Context, ipfs iface.CoreAPI, p path.Resolved, key []byte) (context.Context, error)
- func UnpinNodeAndBranch(ctx context.Context, ipfs iface.CoreAPI, pth path.Resolved, key []byte) (context.Context, error)
- func UnpinPath(ctx context.Context, ipfs iface.CoreAPI, path path.Path) (context.Context, error)
- func UpdateOrAddPin(ctx context.Context, ipfs iface.CoreAPI, from, to path.Path) (context.Context, error)
- type BucketOwner
- type NamedNode
- type NamedNodes
- type PathNode
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidNodeType = errors.New("invalid node type")
ErrInvalidNodeType indicates a node with type other than raw of proto was encountered.
var ( // ErrStorageQuotaExhausted indicates the requested operation exceeds the storage allowance. ErrStorageQuotaExhausted = errors.New("storage quota exhausted") )
Functions ¶
func AddAndPinNodes ¶
func AddAndPinNodes(ctx context.Context, ipfs iface.CoreAPI, nodes []ipld.Node) (context.Context, error)
AddAndPinNodes adds and pins nodes, accounting for sum bytes pinned for context.
func AddPinnedBytes ¶
AddPinnedBytes adds the provided delta to a running total for context.
func CopyDag ¶
func CopyDag( ctx context.Context, ipfs iface.CoreAPI, buck *collection.Bucket, root ipld.Node, fromPath string, toPath string, ) (context.Context, path.Resolved, error)
CopyDag make a copy of a node, re-encrypting it if the source and destination paths have different file keys. The copied node will be pinned.
func CreateBucketPath ¶
func CreateBucketPath( ctx context.Context, ipfs iface.CoreAPI, seed ipld.Node, key []byte, ) (context.Context, path.Resolved, error)
CreateBucketPath creates an IPFS path which only contains the seed file. The returned path will be pinned.
func CreateBucketPathWithCid ¶
func CreateBucketPathWithCid( ctx context.Context, ipfs iface.CoreAPI, buckPath string, cid cid.Cid, linkKey, fileKey []byte, seed ipld.Node, ) (context.Context, path.Resolved, error)
CreateBucketPathWithCid creates an IPFS path from a UnixFS dag. with collection.SeedName seed file added to the root of the dag. The returned path will be pinned.
func DecryptData ¶
DecryptData decrypts data with key.
func DecryptNode ¶
DecryptNode returns a decrypted version of node and whether or not it is a directory.
func EncryptDag ¶
func EncryptDag( ctx context.Context, ipfs iface.CoreAPI, root ipld.Node, destPath string, linkKey []byte, currentFileKeys, newFileKeys map[string][]byte, newFileKey []byte, add *NamedNode, ) (map[cid.Cid]*NamedNode, error)
EncryptDag creates an encrypted version of root that includes all child nodes. Leaf nodes are encrypted and linked to parents, which are then encrypted and linked to their parents, and so on up to root. add will be added to the encrypted root node if not nil. This method returns a map of all nodes keyed by their _original_ plaintext cid, and a list of the root's direct links.
func EncryptData ¶
EncryptData encrypts data with the new key, decrypting with current key if needed.
func EncryptFileNode ¶
func EncryptFileNode( ctx context.Context, ipfs iface.CoreAPI, n ipld.Node, currentKey, newKey []byte, ) (ipld.Node, error)
EncryptFileNode encrypts node with the new key, decrypting with current key if needed.
func EncryptNode ¶
EncryptNode returns the encrypted version of node if key is not nil.
func GetNodeAtPath ¶
func GetNodeAtPath( ctx context.Context, ipfs iface.CoreAPI, pth path.Path, key []byte, ) (ipld.Node, error)
GetNodeAtPath returns the node at path by traversing and potentially decrypting parent nodes.
func GetPathSize ¶
GetPathSize returns the cummulative size of root. If root is nil, it returns 0.
func GetPinnedBytes ¶
GetPinnedBytes returns the total pinned bytes for context.
func InsertNodeAtPath ¶
func InsertNodeAtPath( ctx context.Context, ipfs iface.CoreAPI, child ipld.Node, pth path.Path, key []byte, ) (context.Context, path.Resolved, error)
InsertNodeAtPath inserts a node at the location of path. Key will be required if the path is encrypted.
func MakeBucketSeed ¶
MakeBucketSeed returns a raw ipld node containing a random seed.
func NewDirFromExistingPath ¶
func NewDirFromExistingPath( ctx context.Context, ipfs iface.CoreAPI, pth path.Path, destPath string, linkKey, fileKey []byte, add ipld.Node, addName string, ) (ipld.Node, []ipld.Node, error)
NewDirFromExistingPath returns a new dir based on path. If keys are not nil, this method recursively walks the path, encrypting files and directories. If add is not nil, it will be included in the resulting (possibly encrypted) node under a link named addName. This method returns the root node and a list of all new nodes (which also includes the root).
func NewOwnerContext ¶
func NewOwnerContext(ctx context.Context, owner *BucketOwner) context.Context
NewOwnerContext returns a new bucket owner context.
func NewResolvedPath ¶
NewResolvedPath returns path.Resolved from a string.
func RemoveNodeAtPath ¶
func RemoveNodeAtPath( ctx context.Context, ipfs iface.CoreAPI, pth path.Path, key []byte, ) (context.Context, path.Resolved, error)
RemoveNodeAtPath removes node at the location of path. Key will be required if the path is encrypted.
func ResolveNodeAtPath ¶
func ResolveNodeAtPath( ctx context.Context, ipfs iface.CoreAPI, pth path.Resolved, key []byte, ) (ipld.Node, bool, error)
ResolveNodeAtPath returns the decrypted node at path and whether or not it is a directory.
func UnpinBranch ¶
func UnpinBranch(ctx context.Context, ipfs iface.CoreAPI, p path.Resolved, key []byte) (context.Context, error)
UnpinBranch walks a the node at path, decrypting (if needed) and unpinning all nodes
func UnpinNodeAndBranch ¶
func UnpinNodeAndBranch( ctx context.Context, ipfs iface.CoreAPI, pth path.Resolved, key []byte, ) (context.Context, error)
UnpinNodeAndBranch unpins a node and its entire branch, accounting for sum bytes pinned for context.
Types ¶
type BucketOwner ¶
BucketOwner provides owner context to the bucket service.
func OwnerFromContext ¶
func OwnerFromContext(ctx context.Context) (*BucketOwner, bool)
OwnerFromContext returns a bucket owner from the context if available.
type NamedNodes ¶
NamedNodes is a unique set of NamedNodes.
func (*NamedNodes) Get ¶
func (nn *NamedNodes) Get(c cid.Cid) *NamedNode
Get node by its original plaintext cid.
func (*NamedNodes) Store ¶
func (nn *NamedNodes) Store(c cid.Cid, n *NamedNode)
Store node by its original plaintext cid.
type PathNode ¶
func GetNodesToPath ¶
func GetNodesToPath( ctx context.Context, ipfs iface.CoreAPI, base path.Resolved, pth string, key []byte, ) (nodes []PathNode, isDir bool, remainder string, err error)
GetNodesToPath returns a list of pathNodes that point to the path, The remaining path segment that was not resolvable is also returned.