Documentation ¶
Index ¶
- Constants
- func CompareObjectIDs(a, b ObjectID) int
- func HashBytes(x HashID) []byte
- func HashCompare(h1, h2 HashID) int
- func HashEqual(h1, h2 HashID) bool
- func HashString(x HashID) string
- type Algorithm
- type AlgorithmRegistration
- type AlgorithmRegistry
- type AlgorithmType
- type Commit
- type CommonID
- type Compression
- type Digest
- type HEAD
- type HashID
- type HashSize
- type HyperHeader
- type HyperMessage
- type Object
- type ObjectID
- type ObjectType
- type Operator
- type PackID
- type PackIdxFanOut
- type PackIndex
- type PackIndexHead
- type PackIndexItem
- type PackedObjectHeader
- type PackedObjectHeaderEx
- type PackedObjectType
- type PathMapping
- type Properties
- type Ref
- type ReferenceName
- type Tag
- type Tree
- type TreeItem
- type TreeItemMode
Constants ¶
const EmptyID = ""
EmptyID 表示空的 ID 值
Variables ¶
This section is empty.
Functions ¶
func CompareObjectIDs ¶ added in v0.1.0
CompareObjectIDs 比较两个 ObjectID 的大小
Types ¶
type Algorithm ¶ added in v0.0.8
type Algorithm interface {
GetInfo() *AlgorithmRegistration
}
Algorithm 表示抽象的算法
type AlgorithmRegistration ¶ added in v0.0.8
type AlgorithmRegistration struct { Name string Type AlgorithmType Provider Algorithm }
AlgorithmRegistration ...
type AlgorithmRegistry ¶ added in v0.0.8
type AlgorithmRegistry interface {
ListRegistrations() []*AlgorithmRegistration
}
AlgorithmRegistry ... [inject:".git-algorithm-registry"]
type AlgorithmType ¶ added in v0.0.8
type AlgorithmType int
AlgorithmType 表示算法的类型
const ( AlgorithmCompression AlgorithmType = 1 AlgorithmDigest AlgorithmType = 2 AlgorithmPathMapping AlgorithmType = 3 )
定义几种算法的类型
type Commit ¶ added in v0.0.2
type Commit struct { HyperMessage Parents []ObjectID Tree ObjectID Author *Operator Committer *Operator }
Commit ...
type Compression ¶ added in v0.0.8
type Compression interface { Algorithm NewReader(r io.Reader) (io.ReadCloser, error) NewWriter(w io.Writer) (io.WriteCloser, error) }
Compression 压缩算法
type HEAD ¶ added in v0.0.5
type HEAD struct { Name ReferenceName // the Primary-Key ID ObjectID // 不常用 }
HEAD 是表示一个 .git/HEAD 的实体
type HashID ¶ added in v0.0.5
HashID 表示git的一个 hash 值
func CreateHashID ¶ added in v0.1.0
CreateHashID 创建 HashID
type HashSize ¶ added in v0.0.8
type HashSize int
HashSize 表示 Hash 的长度, 单位是 byte
func (HashSize) SizeInBytes ¶ added in v0.0.8
SizeInBytes ...
type HyperHeader ¶ added in v0.0.5
HyperHeader ...
func (*HyperHeader) AddValue ¶ added in v0.0.5
func (inst *HyperHeader) AddValue(v string)
AddValue ....
func (*HyperHeader) AddValues ¶ added in v0.0.5
func (inst *HyperHeader) AddValues(src []string)
AddValues ....
type HyperMessage ¶ added in v0.0.5
type HyperMessage struct { ID ObjectID Headers map[string]*HyperHeader Content string }
HyperMessage ...
type Object ¶ added in v0.0.8
type Object struct { ID ObjectID Type ObjectType Length int64 }
Object 表示一个git对象
type ObjectID ¶ added in v0.0.5
type ObjectID HashID
ObjectID 表示git的 object-ID
func CreateObjectID ¶ added in v0.0.5
CreateObjectID ...
func ParseObjectID ¶ added in v0.0.5
ParseObjectID ...
type ObjectType ¶ added in v0.0.8
type ObjectType string
ObjectType 表示git对象类型
const ( ObjectTypeTag ObjectType = "tag" ObjectTypeCommit ObjectType = "commit" ObjectTypeTree ObjectType = "tree" ObjectTypeBLOB ObjectType = "blob" ObjectTypeOfsDelta ObjectType = "OBJ_OFS_DELTA" ObjectTypeRefDelta ObjectType = "OBJ_REF_DELTA" )
定义各种对象类型
func (ObjectType) String ¶ added in v0.0.8
func (v ObjectType) String() string
type PackIdxFanOut ¶ added in v0.0.8
type PackIdxFanOut struct {
Data [256]uint32
}
PackIdxFanOut ...
type PackIndex ¶ added in v0.0.8
type PackIndex struct { Head PackIndexHead Items []*PackIndexItem }
PackIndex ...
type PackIndexHead ¶ added in v0.0.8
type PackIndexHead struct { Version int // 1 or 2 Total int64 FanOut PackIdxFanOut }
PackIndexHead ...
type PackIndexItem ¶ added in v0.0.8
type PackIndexItem struct { OID ObjectID Offset int64 // the offset in pack file CRC32 uint32 // ext PID PackID Exists bool Index int64 // the index in idx table Length int64 Type ObjectType PackedType PackedObjectType // in-pack entity }
PackIndexItem ...
type PackedObjectHeader ¶ added in v0.0.8
type PackedObjectHeader struct { Type PackedObjectType Size int64 }
PackedObjectHeader ...
type PackedObjectHeaderEx ¶ added in v0.0.8
type PackedObjectHeaderEx struct { PackedObjectHeader PID PackID OID ObjectID Offset int64 // head(type+length) // Offset1 int64 // end(type+length) // Offset2 int64 // head(raw_data) // Offset3 int64 // end(raw_data) CRC32 int64 // = idx.item[n].crc32 DeltaRef ObjectID DeltaOffset int64 }
PackedObjectHeaderEx ...
func (*PackedObjectHeaderEx) GetDeltaParentOffset ¶ added in v0.0.8
func (inst *PackedObjectHeaderEx) GetDeltaParentOffset() int64
GetDeltaParentOffset 计算 delta-parent 的绝对位置
type PackedObjectType ¶ added in v0.0.8
type PackedObjectType int
PackedObjectType 表示pack内对象的类型
const ( PackedCommit PackedObjectType = 1 // OBJ_COMMIT = (1) PackedTree PackedObjectType = 2 // OBJ_TREE = (2) PackedBLOB PackedObjectType = 3 // OBJ_BLOB = (3) PackedTag PackedObjectType = 4 // OBJ_TAG = (4) PackedDeltaOFS PackedObjectType = 6 // OBJ_OFS_DELTA = (6) PackedDeltaRef PackedObjectType = 7 // OBJ_REF_DELTA = (7) )
定义 pack 对象类型
func (PackedObjectType) ToObjectType ¶ added in v0.0.8
func (v PackedObjectType) ToObjectType() ObjectType
ToObjectType ... 转换为 git.ObjectType 类型
type PathMapping ¶ added in v0.0.8
type PathMapping interface { Algorithm WithPattern(pattern string) PathMapping Map(base afs.Path, id ObjectID) afs.Path }
PathMapping 路径映射算法
type Properties ¶ added in v0.0.5
type Properties struct {
// contains filtered or unexported fields
}
Properties 表示属性文档格式,例如 .git/config 文件
func (*Properties) Export ¶ added in v0.0.5
func (inst *Properties) Export(dst map[string]string) map[string]string
Export ...
func (*Properties) Import ¶ added in v0.0.5
func (inst *Properties) Import(src map[string]string)
Import ...
type Ref ¶ added in v0.0.5
type Ref struct { ID ObjectID // the Primary-Key Name ReferenceName // 不常用 }
Ref 是表示一个 .git/refs/[type]/[name] 的实体
type ReferenceName ¶ added in v0.0.5
type ReferenceName string
ReferenceName is the name for .git/refs/*
func (ReferenceName) IsWildcard ¶ added in v0.0.8
func (v ReferenceName) IsWildcard() bool
IsWildcard ...
func (ReferenceName) Normalize ¶ added in v0.0.5
func (v ReferenceName) Normalize() ReferenceName
Normalize ...
func (ReferenceName) NormalizeWithType ¶ added in v0.0.5
func (v ReferenceName) NormalizeWithType(aType string) ReferenceName
NormalizeWithType ...
func (ReferenceName) String ¶ added in v0.0.5
func (v ReferenceName) String() string
type Tag ¶ added in v0.0.5
type Tag struct { HyperMessage Target ObjectID Author *Operator Committor *Operator }
Tag ...
type TreeItem ¶ added in v0.0.5
type TreeItem struct { Name string ID ObjectID // 该条目的 ID Mode TreeItemMode }
TreeItem ...
func (*TreeItem) Executable ¶ added in v0.0.8
Executable ...
type TreeItemMode ¶ added in v0.0.8
type TreeItemMode string
TreeItemMode 表示树上文件(或子目录)的模式
const ( TreeItemModeFolder TreeItemMode = "40000" TreeItemModeFile TreeItemMode = "100644" TreeItemModeExe TreeItemMode = "100755" )
定义树上文件模式