Documentation
¶
Index ¶
- Constants
- Variables
- func IsValidPath(path string) bool
- func ValidateHeader(h Header) error
- func VersionIsGreater(a, b Header) bool
- type Commit
- type Header
- func (h *Header) Add(key, value string)
- func (h *Header) AddBytes(key string, value []byte)
- func (h *Header) AddInt(key string, value int64)
- func (h *Header) AddTime(key string, value time.Time)
- func (h Header) Copy() Header
- func (h Header) Created() time.Time
- func (h *Header) Delete(key string)
- func (h Header) Deleted() bool
- func (h Header) FileMerkle() []byte
- func (h Header) FileSize() int64
- func (h Header) Get(key string) string
- func (h Header) GetBytes(key string) []byte
- func (h Header) GetInt(key string) int64
- func (h Header) GetTime(key string) time.Time
- func (h Header) Has(key string) bool
- func (h Header) Hash() []byte
- func (h Header) IsDir() bool
- func (h Header) IsFile() bool
- func (h Header) Length() (n int)
- func (h Header) MarshalJSON() ([]byte, error)
- func (h Header) PartSize() int64
- func (h Header) Path() string
- func (h Header) Protocol() string
- func (h Header) PublicKey() crypto.PublicKey
- func (h *Header) Set(key, value string)
- func (h *Header) SetBytes(key string, value []byte)
- func (h *Header) SetInt(key string, value int64)
- func (h *Header) SetPublicKey(pub crypto.PublicKey)
- func (h *Header) SetTime(key string, value time.Time)
- func (h *Header) Sign(prv crypto.PrivateKey)
- func (h Header) String() string
- func (h Header) TreeMerkleRoot() []byte
- func (h *Header) UnmarshalJSON(data []byte) (err error)
- func (h Header) Updated() time.Time
- func (h Header) Ver() int64
- func (h Header) Verify() bool
- type HeaderField
- type VFS
Constants ¶
View Source
const ( MaxHeaderNameLength = 256 MaxHeaderValueLength = 10 * 1024 // 10 KiB )
View Source
const ( DefaultProtocol = "0.1" DefaultFilePartSize = 1 << 20 // (1 MiB) – default file part size MaxPathNameLength = 255 MaxPathLevels = 6 MaxPathDirFilesCount = 4096 )
Variables ¶
View Source
var ( ErrNotFound = errors.New("not found") ErrTooManyFiles = errors.New("too many files") )
Functions ¶
func ValidateHeader ¶
func VersionIsGreater ¶
VersionIsGreater checks that the version of header A is higher than the version of header B
Types ¶
type Header ¶
type Header []HeaderField
func NewRootHeader ¶
func (Header) FileMerkle ¶
func (Header) MarshalJSON ¶
func (*Header) SetPublicKey ¶
func (*Header) Sign ¶
func (h *Header) Sign(prv crypto.PrivateKey)
func (Header) TreeMerkleRoot ¶
func (*Header) UnmarshalJSON ¶
type HeaderField ¶
type VFS ¶
type VFS interface { // FileHeader returns Header of file or directory FileHeader(path string) (Header, error) // FileMerkleWitness returns hash and merkle-witness for file or dir-header FileMerkleWitness(path string) (hash, witness []byte, err error) // FileParts returns hashes of file-parts FileParts(path string) (hashes [][]byte, err error) // OpenAt opens file as descriptor OpenAt(path string, offset int64) (io.ReadCloser, error) // ReadDir returns headers of directory files ReadDir(path string) ([]Header, error) // GetCommit makes commit starting from the given version GetCommit(ver int64) (*Commit, error) Get(request string) (*Commit, error) // Commit applies a commit Commit(*Commit) error }
VFS is Virtual File System
Source Files
¶
Click to show internal directories.
Click to hide internal directories.