store

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: May 27, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidHead = errors.New("error: invalid HEAD format")
)
View Source
var (
	ErrInvalidIdentifier = errors.New("fatal: invalid identifier")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	Conf *Config
	Idx  *Index
	Head
	RootGoitPath string
}

func NewClient

func NewClient(config *Config, index *Index, head Head, rootGoitPath string) *Client

type Config

type Config struct {
	Map map[string]KV
}

func NewConfig

func NewConfig(rootGoitDir string) (*Config, error)

func (*Config) Add

func (c *Config) Add(ident, key, value string)

func (*Config) IsUserSet

func (c *Config) IsUserSet() bool

func (*Config) Write

func (c *Config) Write(rootGoitPath string) error

type Entry

type Entry struct {
	Hash       sha.SHA1
	NameLength uint16
	Path       []byte
}

func NewEntry

func NewEntry(hash sha.SHA1, path []byte) *Entry
type Head string

func NewHead

func NewHead(rootGoitPath string) (Head, error)
type Header struct {
	Signature [4]byte
	Version   uint32
	EntryNum  uint32
}

type Index

type Index struct {
	Header
	Entries []*Entry // sorted entries
}

func NewIndex

func NewIndex(rootGoitPath string) (*Index, error)

func (*Index) DeleteUntrackedFiles

func (idx *Index) DeleteUntrackedFiles(indexPath string) error

func (*Index) Update

func (idx *Index) Update(indexPath string, hash sha.SHA1, path []byte) (bool, error)

type KV

type KV map[string]string

Jump to

Keyboard shortcuts

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