Documentation

Overview

    Package node implement the node specification for the filetree extension.

    Index

    Constants

    View Source
    const (
    	File = "file"
    	Dir  = "dir"
    )
    View Source
    const (
    	V1 = "1"
    )

    Variables

    View Source
    var (
    	NodeBlobHeader          = []byte("#blobstash/node\n")
    	NodeBlobMsgpackEncoding = byte('1')
    	NodeBlobOverhead        = len(NodeBlobHeader) + 1
    )

    Functions

    func IsNodeBlob

    func IsNodeBlob(blob []byte) ([]byte, bool)

    Types

    type IndexValue

    type IndexValue struct {
    	Index int64  `json:"i" msgpack:"i"`
    	Value string `json:"ref" msgpack:"r"`
    }

    type RawNode

    type RawNode struct {
    	ModTime     int64                  `msgpack:"mt,omitempty"`
    	ChangeTime  int64                  `msgpack:"ct,omitempty"`
    	Mode        uint32                 `msgpack:"mo,omitempty"`
    	Name        string                 `msgpack:"n"`
    	Type        string                 `msgpack:"t"`
    	Size        int                    `msgpack:"s"`
    	Refs        []interface{}          `msgpack:"r"`
    	Version     string                 `msgpack:"v"`
    	ContentHash string                 `msgpack:"ch"`
    	Metadata    map[string]interface{} `msgpack:"m,omitempty"`
    	Hash        string                 `msgpack:"-"`
    }

    func NewNodeFromBlob

    func NewNodeFromBlob(hash string, blob []byte) (*RawNode, error)

    func (*RawNode) AddData

    func (n *RawNode) AddData(key string, val interface{})

      AddData insert a new meta data in the Data field

      func (*RawNode) AddIndexedRef

      func (n *RawNode) AddIndexedRef(index int, hash string)

      func (*RawNode) AddRef

      func (n *RawNode) AddRef(hash string)

      func (*RawNode) ContentType

      func (n *RawNode) ContentType() string

      func (*RawNode) Encode

      func (n *RawNode) Encode() (string, []byte)

        JSON returns the `Node` encoded as (hash, blob)

        func (*RawNode) FileRefs

        func (n *RawNode) FileRefs() []*IndexValue

        func (*RawNode) IsFile

        func (n *RawNode) IsFile() bool

          IsFile returns true if the Meta is a file.

          Source Files