cache

package
v1.0.24 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INDEX = iota
	CHUNK
)

Variables

This section is empty.

Functions

func RemoveOldCache added in v1.0.4

func RemoveOldCache(maxCacheAge time.Duration) error

RemoveOldCache remove old cache after max time exists

Types

type Chunk

type Chunk struct {
	BackupDirectoryID string              `json:"backup_directory_id"`
	RecoveryPointID   string              `json:"recovery_point_id"`
	Chunks            map[string][]string `json:"chunks"`
}

func NewChunk

func NewChunk(bdID string, rpID string) *Chunk

type ChunkInfo

type ChunkInfo struct {
	Start  uint   `json:"start"`
	Length uint   `json:"length"`
	Etag   string `json:"etag"`
}

type Index

type Index struct {
	BackupDirectoryID string           `json:"backup_directory_id"`
	RecoveryPointID   string           `json:"recovery_point_id"`
	Items             map[string]*Node `json:"items"`
	TotalFiles        int64            `json:"total_files"`
}

func NewIndex

func NewIndex(bdID string, rpID string) *Index

type Node

type Node struct {
	Name         string       `json:"name"`
	Type         string       `json:"type"`
	Sha256Hash   Sha256Hash   `json:"sha256_hash,omitempty"`
	Mode         os.FileMode  `json:"mode,omitempty"`
	ModTime      time.Time    `json:"mtime,omitempty"`
	AccessTime   time.Time    `json:"atime,omitempty"`
	ChangeTime   time.Time    `json:"ctime,omitempty"`
	UID          uint32       `json:"uid"`
	GID          uint32       `json:"gid"`
	User         string       `json:"user,omitempty"`
	Group        string       `json:"group,omitempty"`
	Size         uint64       `json:"size,omitempty"`
	LinkTarget   string       `json:"linktarget,omitempty"`
	Content      []*ChunkInfo `json:"content,omitempty"`
	AbsolutePath string       `json:"path"`
	BasePath     string       `json:"base_path"`
	RelativePath string       `json:"relative_path"`
}

func NodeFromFileInfo

func NodeFromFileInfo(rootPath string, pathName string, fi os.FileInfo) (*Node, error)

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

func NewRepository

func NewRepository(path string, mcID string, rpID string) (*Repository, error)

NewDirRepository creates a new dir-baked repository at the given path.

func (*Repository) SaveChunk

func (r *Repository) SaveChunk(chunk *Chunk) error

func (*Repository) SaveIndex

func (r *Repository) SaveIndex(index *Index) error

type Sha256Hash

type Sha256Hash []byte

func (Sha256Hash) MarshalJSON

func (h Sha256Hash) MarshalJSON() ([]byte, error)

func (Sha256Hash) String

func (h Sha256Hash) String() string

func (*Sha256Hash) UnmarshalJSON

func (h *Sha256Hash) UnmarshalJSON(b []byte) error

type Type

type Type int

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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