Documentation ¶
Index ¶
- Constants
- Variables
- func IsErrMismatchedObjectType(err error) bool
- func Join(root string, oid plumbing.Hash) string
- func NewErrMismatchedObjectType(oid plumbing.Hash, t string) error
- func PackObjects(ctx context.Context, opts *PackOptions) error
- type CompressMethod
- type Database
- func (d *Database) Blob(_ context.Context, oid plumbing.Hash) (blob *object.Blob, err error)
- func (d *Database) Close() error
- func (d *Database) Commit(ctx context.Context, oid plumbing.Hash) (*object.Commit, error)
- func (d *Database) CompressionALGO() string
- func (d *Database) Exists(oid plumbing.Hash, metadata bool) error
- func (d *Database) Fragments(ctx context.Context, oid plumbing.Hash) (*object.Fragments, error)
- func (d *Database) HashTo(ctx context.Context, r io.Reader, size int64) (oid plumbing.Hash, err error)
- func (d *Database) JoinPart(oid plumbing.Hash) string
- func (d *Database) NewFD(oid plumbing.Hash) (*os.File, error)
- func (d *Database) NewTruncateFD(oid plumbing.Hash) (*os.File, error)
- func (d *Database) NewUnpacker(entries uint32, metadata bool) (*Unpacker, error)
- func (d *Database) NewUnpackerEx(entries uint32, metadata bool, method CompressMethod) (*Unpacker, error)
- func (d *Database) Object(_ context.Context, oid plumbing.Hash) (any, error)
- func (d *Database) OpenReader(oid plumbing.Hash, meta bool) (io.ReadCloser, error)
- func (d *Database) ParseRevEx(ctx context.Context, oid plumbing.Hash) (*object.Commit, []plumbing.Hash, error)
- func (d *Database) PruneObject(ctx context.Context, oid plumbing.Hash, metadata bool) error
- func (d *Database) PruneObjects(ctx context.Context, largeSize int64) ([]plumbing.Hash, int64, error)
- func (d *Database) Reload() error
- func (d *Database) Root() string
- func (d *Database) Search(prefix string) (oid plumbing.Hash, err error)
- func (d *Database) Size(oid plumbing.Hash, meta bool) (size int64, err error)
- func (d *Database) SizeReader(oid plumbing.Hash, meta bool) (SizeReader, error)
- func (d *Database) Tag(ctx context.Context, oid plumbing.Hash) (*object.Tag, error)
- func (d *Database) Tree(ctx context.Context, oid plumbing.Hash) (*object.Tree, error)
- func (d *Database) ValidateFD(fd *os.File, oid plumbing.Hash) error
- func (d *Database) ValidatePart(saveTo string, oid plumbing.Hash) error
- func (d *Database) WriteEncoded(e object.Encoder) (oid plumbing.Hash, err error)
- func (d *Database) WriteTo(ctx context.Context, oid plumbing.Hash, r io.Reader) error
- type ErrMismatchedObjectType
- type ExtendWriter
- type Indicators
- type LooseObject
- type LooseObjects
- type NewIndicators
- type Option
- type PackOptions
- type SizeReader
- type Unpacker
Constants ¶
View Source
const ( DefaultHashALGO = "BLAKE3" DefaultCompressionALGO = "zstd" )
View Source
const (
BLANK_BLOB = "af1349b9f5f9a1a6a0404dea36dcc9499bcb25c9adc112b7cc9a93cae41f3262"
)
View Source
const (
DefaultPackThreshold = 50 * 1024 * 1024 // 50M
)
View Source
const (
// ZstandardMagic: https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#frames
ZstandardMagic = 0xFD2FB528
)
Variables ¶
View Source
var (
BLANK_BLOB_HASH = plumbing.NewHash(BLANK_BLOB)
)
View Source
var (
ErrCanceled = context.Canceled
)
View Source
var (
ErrUncacheableObject = errors.New("uncacheable object")
)
Functions ¶
func PackObjects ¶
func PackObjects(ctx context.Context, opts *PackOptions) error
Types ¶
type CompressMethod ¶
type CompressMethod uint16
const ( STORE CompressMethod = 0 ZSTD CompressMethod = 1 BROTLI CompressMethod = 2 DEFLATE CompressMethod = 3 XZ CompressMethod = 4 BZ2 CompressMethod = 5 )
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func (*Database) Close ¶
Close closes the *Database
If Close() has already been called, this function will return an error.
func (*Database) CompressionALGO ¶
func (*Database) HashTo ¶
func (d *Database) HashTo(ctx context.Context, r io.Reader, size int64) (oid plumbing.Hash, err error)
HashTo:
size == -1: unknown file size, need to detect file size. size == 0: empty file, returns the specified BLOB. size > 0: the file size is known.
func (*Database) NewTruncateFD ¶
func (*Database) NewUnpacker ¶
func (*Database) NewUnpackerEx ¶
func (*Database) OpenReader ¶
func (*Database) ParseRevEx ¶
func (*Database) PruneObject ¶
func (*Database) PruneObjects ¶
func (*Database) SizeReader ¶
func (*Database) ValidatePart ¶
func (*Database) WriteEncoded ¶
type ErrMismatchedObjectType ¶
type ErrMismatchedObjectType struct {
// contains filtered or unexported fields
}
func (*ErrMismatchedObjectType) Error ¶
func (e *ErrMismatchedObjectType) Error() string
type ExtendWriter ¶
type ExtendWriter interface { io.ReaderFrom io.Writer }
type Indicators ¶
type LooseObjects ¶
type LooseObjects []*LooseObject
type NewIndicators ¶
type NewIndicators func(description, completed string, total uint64, quiet bool) Indicators
type Option ¶
type Option func(*Database)
func WithAbstractBackend ¶
func WithCompressionALGO ¶
func WithEnableLRU ¶
func WithSharingRoot ¶
type PackOptions ¶
type PackOptions struct { ZetaDir string SharingRoot string Quiet bool CompressionALGO string PackThreshold int64 Logger func(format string, a ...any) NewIndicators NewIndicators }
func (*PackOptions) Printf ¶
func (opts *PackOptions) Printf(format string, a ...any)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.