archivist

package
v0.0.0-...-8fc8cfd Latest Latest
Warning

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

Go to latest
Published: May 11, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_proto_files_proto protoreflect.FileDescriptor
View Source
var File_proto_index_proto protoreflect.FileDescriptor

Functions

func FindMovies

func FindMovies(idx *Index, re *regexp.Regexp) map[string][]string

FindMovies searches for a movies in the archive. Returns a map of Movie name to filesystems storing _some_ part of it.

func FindTV

func FindTV(idx *Index, re *regexp.Regexp) map[string][]string

FindTV searches for a TV show in the archive. Returns a map of show name to filesystems storing _some_ part of it.

func ReadProtoIndex

func ReadProtoIndex(path string, data proto.Message) error

func WriteProtoIndex

func WriteProtoIndex(data proto.Message, path string) error

Types

type Blob

type Blob struct {
	Id        string     `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Size      uint64     `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"`
	Integrity *Integrity `protobuf:"bytes,3,opt,name=integrity,proto3" json:"integrity,omitempty"`
	// contains filtered or unexported fields
}

Blob is an archived collection of bytes.

func NewBlob

func NewBlob(path string) (*Blob, error)

NewBlob creates a Blob for a file path.

func (*Blob) Descriptor deprecated

func (*Blob) Descriptor() ([]byte, []int)

Deprecated: Use Blob.ProtoReflect.Descriptor instead.

func (*Blob) GetId

func (x *Blob) GetId() string

func (*Blob) GetIntegrity

func (x *Blob) GetIntegrity() *Integrity

func (*Blob) GetSize

func (x *Blob) GetSize() uint64

func (*Blob) ProtoMessage

func (*Blob) ProtoMessage()

func (*Blob) ProtoReflect

func (x *Blob) ProtoReflect() protoreflect.Message

func (*Blob) Reset

func (x *Blob) Reset()

func (*Blob) String

func (x *Blob) String() string

type BlobIndex

type BlobIndex struct {
	ByID map[string]*Blob
}

func NewBlobIndex

func NewBlobIndex(blobs []*Blob) *BlobIndex

type File

type File struct {
	BlobId  string                 `protobuf:"bytes,1,opt,name=blob_id,json=blobId,proto3" json:"blob_id,omitempty"`
	ModTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=mod_time,json=modTime,proto3" json:"mod_time,omitempty"`
	// contains filtered or unexported fields
}

File is a Blob observed a particular time.

func (*File) Descriptor deprecated

func (*File) Descriptor() ([]byte, []int)

Deprecated: Use File.ProtoReflect.Descriptor instead.

func (*File) GetBlobId

func (x *File) GetBlobId() string

func (*File) GetModTime

func (x *File) GetModTime() *timestamppb.Timestamp

func (*File) ProtoMessage

func (*File) ProtoMessage()

func (*File) ProtoReflect

func (x *File) ProtoReflect() protoreflect.Message

func (*File) Reset

func (x *File) Reset()

func (*File) String

func (x *File) String() string

type Filesystem

type Filesystem struct {
	Paths map[string]*File `` /* 151-byte string literal not displayed */
	// contains filtered or unexported fields
}

Filesystem is an index of Files.

func (*Filesystem) Descriptor deprecated

func (*Filesystem) Descriptor() ([]byte, []int)

Deprecated: Use Filesystem.ProtoReflect.Descriptor instead.

func (*Filesystem) GetPaths

func (x *Filesystem) GetPaths() map[string]*File

func (*Filesystem) ProtoMessage

func (*Filesystem) ProtoMessage()

func (*Filesystem) ProtoReflect

func (x *Filesystem) ProtoReflect() protoreflect.Message

func (*Filesystem) Reset

func (x *Filesystem) Reset()

func (*Filesystem) String

func (x *Filesystem) String() string

type Index

type Index struct {
	Blobs       []*Blob                `protobuf:"bytes,1,rep,name=blobs,proto3" json:"blobs,omitempty"`
	Filesystems map[string]*Filesystem `` /* 163-byte string literal not displayed */
	// contains filtered or unexported fields
}

Index stores data for later retrieval.

func (*Index) Descriptor deprecated

func (*Index) Descriptor() ([]byte, []int)

Deprecated: Use Index.ProtoReflect.Descriptor instead.

func (*Index) GetBlobs

func (x *Index) GetBlobs() []*Blob

func (*Index) GetFilesystem

func (i *Index) GetFilesystem(root string) *Filesystem

func (*Index) GetFilesystems

func (x *Index) GetFilesystems() map[string]*Filesystem

func (*Index) ProtoMessage

func (*Index) ProtoMessage()

func (*Index) ProtoReflect

func (x *Index) ProtoReflect() protoreflect.Message

func (*Index) Reset

func (x *Index) Reset()

func (*Index) String

func (x *Index) String() string

type Integrity

type Integrity struct {
	Sha512     []byte `protobuf:"bytes,1,opt,name=sha512,proto3" json:"sha512,omitempty"`
	Blake2B512 []byte `protobuf:"bytes,2,opt,name=blake2b512,proto3" json:"blake2b512,omitempty"`
	// contains filtered or unexported fields
}

Integrity are hashes of byte content.

func NewFileIntegrity

func NewFileIntegrity(path string) (*Integrity, error)

NewFileIntegrity calculates hashes on a file path.

func NewIntegrity

func NewIntegrity(r io.Reader) (*Integrity, error)

NewIntegrity consumes a Reader to hash data.

func (*Integrity) Descriptor deprecated

func (*Integrity) Descriptor() ([]byte, []int)

Deprecated: Use Integrity.ProtoReflect.Descriptor instead.

func (*Integrity) GetBlake2B512

func (x *Integrity) GetBlake2B512() []byte

func (*Integrity) GetSha512

func (x *Integrity) GetSha512() []byte

func (*Integrity) ProtoMessage

func (*Integrity) ProtoMessage()

func (*Integrity) ProtoReflect

func (x *Integrity) ProtoReflect() protoreflect.Message

func (*Integrity) Reset

func (x *Integrity) Reset()

func (*Integrity) String

func (x *Integrity) String() string

type PathSummary

type PathSummary struct {
	FileCount   uint64
	FileSizeSum uint64
}

func Summarize

func Summarize(idx *Index, filesystem string, prefix string) PathSummary

func (PathSummary) String

func (p PathSummary) String() string

Jump to

Keyboard shortcuts

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