loose

package
v0.1.39 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package loose provides a loose object backend (objects/XX/YYYYY..).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store reads loose Git objects from an objects directory root.

Store owns root and closes it in Close.

func New

func New(root *os.Root, algo objectid.Algorithm) (*Store, error)

New creates a loose-object store rooted at an objects directory for algo.

func (*Store) Close

func (store *Store) Close() error

Close releases resources associated with the backend.

func (*Store) ReadBytesContent

func (store *Store) ReadBytesContent(id objectid.ObjectID) (objecttype.Type, []byte, error)

ReadBytesContent reads an object's type and content bytes.

func (*Store) ReadBytesFull

func (store *Store) ReadBytesFull(id objectid.ObjectID) ([]byte, error)

ReadBytesFull reads a full serialized object as "type size\0content".

func (*Store) ReadHeader

func (store *Store) ReadHeader(id objectid.ObjectID) (objecttype.Type, int64, error)

ReadHeader reads an object's type and declared content length.

func (*Store) ReadReaderContent

func (store *Store) ReadReaderContent(id objectid.ObjectID) (objecttype.Type, int64, io.ReadCloser, error)

ReadReaderContent reads an object's type, declared content length, and content stream. The caller must close the returned reader.

func (*Store) ReadReaderFull

func (store *Store) ReadReaderFull(id objectid.ObjectID) (io.ReadCloser, error)

ReadReaderFull reads a full serialized object stream as "type size\0content". The caller must close the returned reader.

func (*Store) ReadSize added in v0.1.28

func (store *Store) ReadSize(id objectid.ObjectID) (int64, error)

ReadSize reads an object's declared content length.

func (*Store) WriteBytesContent

func (store *Store) WriteBytesContent(ty objecttype.Type, content []byte) (objectid.ObjectID, error)

WriteBytesContent writes typed content bytes as a loose object.

func (*Store) WriteBytesFull

func (store *Store) WriteBytesFull(raw []byte) (objectid.ObjectID, error)

WriteBytesFull writes a full serialized object as "type size\0content".

func (*Store) WriteReaderContent added in v0.1.22

func (store *Store) WriteReaderContent(ty objecttype.Type, size int64, src io.Reader) (objectid.ObjectID, error)

WriteReaderContent writes one loose object from typed content bytes read from src. src must provide exactly size bytes. size is required because loose object headers are "type size\0content", so the header must be emitted before streaming content without buffering.

func (*Store) WriteReaderFull added in v0.1.22

func (store *Store) WriteReaderFull(src io.Reader) (objectid.ObjectID, error)

WriteReaderFull writes one loose object from raw bytes "type size\0content" read from src.

Jump to

Keyboard shortcuts

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