objects

package
v0.0.0-...-4fdccdd Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ObjectInvalid objectType = iota
	ObjectBlob
	ObjectTree
	ObjectCommit
)

Variables

This section is empty.

Functions

func CommittedFiles

func CommittedFiles(sha []byte) ([]*gfs.File, error)

func ObjectReadCloser

func ObjectReadCloser(sha []byte) func() (io.ReadCloser, error)

func ReadHeadBytes

func ReadHeadBytes(r io.ReadCloser, obj *Object) error

func WriteCommit

func WriteCommit(c *Commit) ([]byte, error)

func WriteObject

func WriteObject(header []byte, content []byte, contentFile string, path string) ([]byte, error)

WriteObject writes an object to the object store

Types

type Commit

type Commit struct {
	Sha            []byte
	Tree           []byte
	Parents        [][]byte
	Author         string
	AuthorEmail    string
	AuthoredTime   time.Time
	Committer      string
	CommitterEmail string
	CommittedTime  time.Time
	Sig            []byte
	Message        []byte
}

func ReadCommit

func ReadCommit(sha []byte) (*Commit, error)

func (Commit) String

func (c Commit) String() string

type Object

type Object struct {
	Path         string
	Typ          objectType
	Sha          []byte
	Objects      []*Object
	Length       int
	HeaderLength int
	ReadCloser   func() (io.ReadCloser, error)
}

func ReadObject

func ReadObject(sha []byte) (*Object, error)

func ReadObjectTree

func ReadObjectTree(sha []byte) (*Object, error)

ReadObjectTree reads an object from the object store

func WriteBlob

func WriteBlob(path string) (*Object, error)

WriteBlob writes a file to the object store as a blob and returns a Blob Object representation.

func (*Object) FlattenTree

func (o *Object) FlattenTree() []*gfs.File

FlattenTree turns a TreeObject structure into a flat list of file paths

func (*Object) WriteTree

func (o *Object) WriteTree() ([]byte, error)

WriteTree writes an Object Tree to the object store.

type Tree

type Tree struct {
	Sha   []byte
	Typ   objectType
	Path  string
	Items []*TreeItem
}

func ReadTree

func ReadTree(obj *Object) (*Tree, error)

type TreeItem

type TreeItem struct {
	Sha  []byte
	Typ  objectType
	Path string
}

Jump to

Keyboard shortcuts

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