api

package
v0.0.1-rc4 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: ISC Imports: 5 Imported by: 4

Documentation

Index

Constants

View Source
const (
	KindDirectory = "directory"
	KindRegular   = "regular"
	KindSymlink   = "symlink"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CAS

type CAS interface {
	CASReader
	CASWriter
}

type CASReader

type CASReader interface {
	// Open returns a reader for the given SRI.
	// If the SRI does not exist, it returns fs.ErrNotExist.
	Open(sri string) (io.ReadCloser, error)
}

type CASWriter

type CASWriter interface {
	Write(sri string, r io.Reader) error
}

type CloseWaitFunc

type CloseWaitFunc func() error

CloseWaitFunc is a function that closes a resource and waits for it to be closed.

type Flat

type Flat struct {
	Files []Stat
}

Flat is a flat representation of a tree. It is used to serialize a tree.

type Node

type Node struct {
	// Stat is the stat (metadata) of the node.
	Stat Stat
	// Children are the children of the node.
	Children []*Node
}

Node is a node in the file system tree.

type NodeAttributes

type NodeAttributes struct {
	// Mtime is the modification time of the node.
	Mtime time.Time `json:"mtime,omitempty"`
	// UserID is the uid of the node.
	UserID string `json:"uid,omitempty"`
	// GroupID is the gid of the node.
	GroupID string `json:"gid,omitempty"`
	// UserName is the name of the user that owns the node.
	UserName string `json:"uname,omitempty"`
	// GroupName is the name of the group that owns the node.
	GroupName string `json:"gname,omitempty"`
	// Mode is the mode of the node.
	Mode string `json:"mode,omitempty"`
	// XAttrs are the extended attributes of the node.
	XAttrs map[string]string `json:"xattrs,omitempty"`
}

NodeAttributes are the attributes of a node.

func (*NodeAttributes) MarshalJSON

func (a *NodeAttributes) MarshalJSON() ([]byte, error)

type Sink

type Sink interface {
	Consume(in fs.FS) error
}

Sink is a sink for nodes. It is used to write nodes to a destination.

type Source

type Source interface {
	// Next returns the next node in the source.
	// If there are no more nodes, it returns io.EOF.
	Next() (SourceNode, error)
}

type SourceNode

type SourceNode struct {
	Stat Stat
	Open func() (io.ReadCloser, error)
}

type Stat

type Stat struct {
	// Name is the name of the node.
	Name string `json:"name"`
	// Kind is the kind of the node.
	Kind string `json:"kind"`
	// Attributes are the attributes of the node.
	Attributes NodeAttributes `json:"attributes,inline"`
	// Payload is a reference to the payload of the node.
	// It uses the Subresource Integrity (SRI) format for regular files.
	// For symlinks, it is the target path.
	Payload string `json:"payload,omitempty"`
	// Size is the size of the node.
	// Only regular files have a size.
	Size int64 `json:"size"`
}

Node is a node in the file system tree.

func (*Stat) MarshalJSON

func (s *Stat) MarshalJSON() ([]byte, error)

func (*Stat) UnmarshalJSON

func (s *Stat) UnmarshalJSON(data []byte) error

type Tree

type Tree struct {
	// Root is the root node of the tree.
	Root *Node
}

Tree is a abstractfs tree.

Jump to

Keyboard shortcuts

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