Documentation ¶
Index ¶
- Constants
- Variables
- type BlobStore
- type FS
- type FSInfo
- type FSUpdateEvent
- type FileTree
- func (ft *FileTree) AddChild(ctx context.Context, snap *Snapshot, n *Node, newChild *rnode.RawNode, ...) (*Node, int64, error)
- func (ft *FileTree) BFS(ctx context.Context, root *Node, fn func(*Node) (bool, error)) (*Node, error)
- func (ft *FileTree) BruteforcePath(ctx context.Context, root, target string) ([]*NodeInfo, error)
- func (ft *FileTree) Close() error
- func (ft *FileTree) CreateFS(ctx context.Context, fsName, prefixFmt string) (*Node, error)
- func (ft *FileTree) DFS(ctx context.Context, root *Node, fn func(*Node) (bool, error)) (*Node, error)
- func (ft *FileTree) Delete(ctx context.Context, snap *Snapshot, n *Node, prefixFmt string, mtime int64) (*Node, int64, error)
- func (ft *FileTree) FS(ctx context.Context, name, prefixFmt string, newState bool, asOf int64) (*FS, error)
- func (ft *FileTree) GetSemiPrivateLink(n *Node) (string, string, error)
- func (ft *FileTree) GetTgzLink(n *Node) (string, error)
- func (ft *FileTree) GetWebmLink(n *Node) (string, string, error)
- func (ft *FileTree) IterFS(ctx context.Context, start string) ([]*FSInfo, error)
- func (ft *FileTree) IterTree(ctx context.Context, root *Node, fn func(*Node, string) error) error
- func (ft *FileTree) LuaFSVersions(name string) ([]*Snapshot, error)
- func (ft *FileTree) Node(ctx context.Context, hash string) (*Node, error)
- func (ft *FileTree) NodeWithChildren(ctx context.Context, hash string) (*Node, error)
- func (ft *FileTree) Register(r *mux.Router, root *mux.Router, basicAuth func(http.Handler) http.Handler)
- func (ft *FileTree) ShareTTL() time.Duration
- func (ft *FileTree) SharingCred() *bewit.Cred
- func (ft *FileTree) TreeBlobs(ctx context.Context, node *Node) ([]string, error)
- func (ft *FileTree) Update(ctx context.Context, snap *Snapshot, n *Node, m *rnode.RawNode, ...) (*Node, int64, error)
- type GraphSearchFunc
- type Info
- type Node
- type NodeInfo
- type Snapshot
Constants ¶
const ( FTBinary = "binary" FTText = "text" FTVideo = "video" FTImage = "image" FTArchive = "archive" FTDocument = "document" )
Variables ¶
var ( // FIXME(tsileo): add a way to set a custom fmt key life for Blobs CLI as we don't care about the FS? FSKeyFmt = "_filetree:fs:%s" MaxUploadSize int64 = 512 << 20 // 512MB )
Functions ¶
This section is empty.
Types ¶
type BlobStore ¶
type BlobStore struct {
// contains filtered or unexported fields
}
func NewBlobStoreCompat ¶
BlobStore is the interface to be compatible with both the server and the BlobStore client
type FS ¶
type FS struct { Name string `json:"-"` Ref string `json:"ref"` AsOf int64 `json:"-"` Revision int64 `json:"-"` // contains filtered or unexported fields }
type FSUpdateEvent ¶
type FSUpdateEvent struct { Name string `json:"fs_name"` Path string `json:"fs_path"` Ref string `json:"node_ref"` Type string `json:"node_type"` Time int64 `json:"event_time"` Hostname string `json:"event_hostname"` SessionID string `json:"session_id"` }
FSUpdateEvent represents an even fired on FS update to the Oplog
func (*FSUpdateEvent) JSON ¶
func (e *FSUpdateEvent) JSON() string
type FileTree ¶
type FileTree struct {
// contains filtered or unexported fields
}
func New ¶
func New(logger log.Logger, conf *config.Config, authFunc func(*http.Request) bool, kvStore store.KvStore, blobStore store.BlobStore, chub *hub.Hub) (*FileTree, error)
New initializes the `DocStoreExt`
func (*FileTree) AddChild ¶
func (ft *FileTree) AddChild(ctx context.Context, snap *Snapshot, n *Node, newChild *rnode.RawNode, prefixFmt string, mtime int64) (*Node, int64, error)
Update the given node with the given meta, the updated/new node is assumed to be already saved
func (*FileTree) BFS ¶
func (ft *FileTree) BFS(ctx context.Context, root *Node, fn func(*Node) (bool, error)) (*Node, error)
BFS performs a Breadth-first search
func (*FileTree) BruteforcePath ¶
BruteforcePath builds the path from a children hash/ref
func (*FileTree) DFS ¶
func (ft *FileTree) DFS(ctx context.Context, root *Node, fn func(*Node) (bool, error)) (*Node, error)
DFS performs a (recursive) Depth-first search
func (*FileTree) Delete ¶
func (ft *FileTree) Delete(ctx context.Context, snap *Snapshot, n *Node, prefixFmt string, mtime int64) (*Node, int64, error)
Delete removes the given node from its parent children
func (*FileTree) FS ¶
func (ft *FileTree) FS(ctx context.Context, name, prefixFmt string, newState bool, asOf int64) (*FS, error)
FS fetch the FileSystem by name, returns an empty one if not found
func (*FileTree) GetSemiPrivateLink ¶
func (*FileTree) LuaFSVersions ¶
func (*FileTree) NodeWithChildren ¶
func (*FileTree) Register ¶
func (ft *FileTree) Register(r *mux.Router, root *mux.Router, basicAuth func(http.Handler) http.Handler)
RegisterRoute registers all the HTTP handlers for the extension
func (*FileTree) SharingCred ¶
type GraphSearchFunc ¶
GraphSearchFunc is the interface type for the different graph transversal algorithms (BFS,DFS)
type Node ¶
type Node struct { Name string `json:"name" msgpack:"n"` Type string `json:"type" msgpack:"t"` FileType string `json:"file_type,omitempty" msgpack:"ft,omitempty"` Size int `json:"size,omitempty" msgpack:"s,omitempty"` Mode int `json:"mode,omitempty" msgpack:"mo,omitempty"` ModTime string `json:"mtime" msgpack:"mt"` ChangeTime string `json:"ctime" msgpack:"ct"` ContentHash string `json:"content_hash,omitempty" msgpack:"ch,omitempty"` Hash string `json:"ref" msgpack:"r"` Children []*Node `json:"children,omitempty" msgpack:"c,omitempty"` ChildrenCount int `json:"children_count,omitempty" msgpack:"cc,omitempty"` // FIXME(ts): rename to Metadata Data map[string]interface{} `json:"metadata,omitempty" msgpack:"md,omitempty"` Info *Info `json:"info,omitempty" msgpack:"i,omitempty"` Meta *rnode.RawNode `json:"-" msgpack:"-"` URL string `json:"url,omitempty" msgpack:"u,omitempty"` URLs map[string]string `json:"urls,omitempty" msgpack:"us,omitempty"` // contains filtered or unexported fields }
Node holds the data about the file node (either file/dir), analog to a Meta
type NodeInfo ¶
type NodeInfo struct {
Name, Ref string
}
NodeInfo represents a node for the path/breadcrumbs
type Snapshot ¶
type Snapshot struct { Ref string `msgpack:"-" json:"ref"` CreatedAt int64 `msgpack:"-" json:"created_at"` Hostname string `msgpack:"h" json:"hostname,omitempty"` Message string `msgpack:"m,omitempty" json:"message,omitempty"` UserAgent string `msgpack:"ua,omitempty" json:"user_agent,omitempty"` }
TODO(tsileo): a way to create a snapshot without modifying anything (and forcing the datactx before)