Documentation ¶
Index ¶
- Constants
- func ExpireAll()
- func IsNotFound(err error) bool
- type Batch
- func (c *Batch) Blob(revspec string) (io.Reader, error)
- func (c *Batch) Close()
- func (c *Batch) Commit(revspec string) (io.Reader, error)
- func (c *Batch) Info(revspec string) (*ObjectInfo, error)
- func (c *Batch) Tag(revspec string) (io.Reader, error)
- func (c *Batch) Tree(revspec string) (io.Reader, error)
- type NotFoundError
- type ObjectInfo
Constants ¶
const ( // CacheFeatureFlagKey is the feature flag key for catfile batch caching. This should match // what is in gitlab-ce CacheFeatureFlagKey = "catfile-cache" // SessionIDField is the gRPC metadata field we use to store the gitaly session ID. SessionIDField = "gitaly-session-id" )
const ( // DefaultBatchfileTTL is the default ttl for batch files to live in the cache DefaultBatchfileTTL = 10 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func ExpireAll ¶ added in v1.38.0
func ExpireAll()
ExpireAll is used to expire all of the batches in the cache
func IsNotFound ¶ added in v0.92.0
IsNotFound tests whether err has type NotFoundError.
Types ¶
type Batch ¶ added in v0.92.0
Batch abstracts 'git cat-file --batch' and 'git cat-file --batch-check'. It lets you retrieve object metadata and raw objects from a Git repo.
A Batch instance can only serve single request at a time. If you want to use it across multiple goroutines you need to add your own locking.
func New ¶ added in v0.92.0
New returns a new Batch instance. It is important that ctx gets canceled somewhere, because if it doesn't the cat-file processes spawned by New() never terminate.
func (*Batch) Blob ¶ added in v0.92.0
Blob returns a reader for the requested blob. The entire blob must be read before any new objects can be requested from this Batch instance.
It is an error if revspec does not point to a blob. To prevent this first use Info to resolve the revspec and check the object type.
func (*Batch) Close ¶ added in v1.38.0
func (c *Batch) Close()
Close closes the writers for batchCheck and batch. This is only used for cached Batches
func (*Batch) Commit ¶ added in v0.92.0
Commit returns a raw commit object. It is an error if revspec does not point to a commit. To prevent this first use Info to resolve the revspec and check the object type. Caller must consume the Reader before making another call on C.
func (*Batch) Info ¶ added in v0.92.0
func (c *Batch) Info(revspec string) (*ObjectInfo, error)
Info returns an ObjectInfo if spec exists. If spec does not exist the error is of type NotFoundError.
func (*Batch) Tag ¶ added in v1.21.0
Tag returns a raw tag object. Caller must consume the Reader before making another call on C.
type NotFoundError ¶ added in v0.92.0
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError is returned when requesting an object that does not exist.
type ObjectInfo ¶
ObjectInfo represents a header returned by `git cat-file --batch`
func (*ObjectInfo) IsBlob ¶ added in v0.116.0
func (o *ObjectInfo) IsBlob() bool
IsBlob returns true if object type is "blob"