pack

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MagicNumberIdxV2 = 0xff744f63 // aka `\xfftOc`
)

定义魔数

Variables

This section is empty.

Functions

func ReadGitVLQ

func ReadGitVLQ(in io.Reader) (int64, error)

ReadGitVLQ ... 读取 git 格式的变长整数

func ReadSimple7bitsInt

func ReadSimple7bitsInt(in io.Reader) (int64, error)

ReadSimple7bitsInt ... 读取 git 格式的变长整数

Types

type CheckFlag

type CheckFlag int

CheckFlag 表示检查标志位, 多个标志位可以通过'|'运算符组合

const (
	CheckSize CheckFlag = 0x0008 // 检查文件的大小
	CheckSum  CheckFlag = 0x0004 // 检查文件的 hash-sum
	CheckHead CheckFlag = 0x0002 // 检查文件的头部

	CheckAll CheckFlag = 0xffff // 进行全面的检查
)

定义各种检查标志位, 多个标志位可以通过'|'运算符组合

type EntityFile

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

EntityFile ...

func (*EntityFile) Check

func (inst *EntityFile) Check(flags CheckFlag) error

Check ...

func (*EntityFile) GetPackID

func (inst *EntityFile) GetPackID() git.PackID

GetPackID ...

func (*EntityFile) Init

func (inst *EntityFile) Init(file *File) error

Init ...

func (*EntityFile) Load

func (inst *EntityFile) Load() error

Load ...

func (*EntityFile) OpenObjectReader

func (inst *EntityFile) OpenObjectReader(item *git.PackIndexItem, pool afs.ReaderPool) (*git.PackedObjectHeaderEx, io.ReadCloser, error)

OpenObjectReader ...

func (*EntityFile) ReadObjectHeader

func (inst *EntityFile) ReadObjectHeader(item *git.PackIndexItem, pool afs.ReaderPool) (*git.PackedObjectHeaderEx, error)

ReadObjectHeader ...

func (*EntityFile) Reload

func (inst *EntityFile) Reload() error

Reload ...

type File

type File struct {
	Digest      git.Digest
	Compression git.Compression
	Pool        afs.ReaderPool
	Path        afs.Path
	Type        FileType
}

File ...

func (*File) Clone

func (inst *File) Clone() *File

Clone ...

func (*File) OpenReader

func (inst *File) OpenReader() (io.ReadSeekCloser, error)

OpenReader ...

type FileType

type FileType string

FileType 表示pack文件的类型

const (
	FileTypeIdx            FileType = ".idx"
	FileTypePack           FileType = ".pack"
	FileTypeRev            FileType = ".rev"
	FileTypeMtimes         FileType = ".mtimes"
	FileTypeMultiPackIndex FileType = "multi-pack-index"
)

定义各种pack文件的类型

type Idx

type Idx interface {
	Load() error
	Reload() error
	Check(flags CheckFlag) error
	GetPackID() git.PackID
	Find(oid git.ObjectID) (*git.PackIndexItem, error)
	Count() int64
	GetItem(index int64) (*git.PackIndexItem, error)
	GetItems(index int64, limit int) ([]*git.PackIndexItem, error)
}

Idx 表示一个 pack-*.idx 文件

func NewIdx

func NewIdx(file *File) (Idx, error)

NewIdx ...

type Pack

type Pack interface {
	Load() error
	Reload() error
	Check(flags CheckFlag) error
	GetPackID() git.PackID

	// 如果 pool 参数为 nil, 则使用内部的 pool 提供数据来源
	OpenObjectReader(item *git.PackIndexItem, pool afs.ReaderPool) (*git.PackedObjectHeaderEx, io.ReadCloser, error)

	// 如果 pool 参数为 nil, 则使用内部的 pool 提供数据来源
	ReadObjectHeader(item *git.PackIndexItem, pool afs.ReaderPool) (*git.PackedObjectHeaderEx, error)
}

Pack 表示一个 pack-*.pack 文件

func NewPack

func NewPack(file *File) (Pack, error)

NewPack ...

Jump to

Keyboard shortcuts

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