Documentation
¶
Overview ¶
Package store keeps the git objects of a repository in packs and the operation objects of a workspace, in one object store. HTTP, grants and the SQL index are in other packages.
Index ¶
- Constants
- Variables
- func ValidWorkspaceID(id string) bool
- type Entry
- type OpKind
- type PackIndex
- type PackRef
- type Repo
- type Service
- func (s *Service) Blobs(ctx context.Context, repo Repo, shas []gitpack.SHA) ([][]byte, error)
- func (s *Service) Commit(ctx context.Context, repo Repo, sha gitpack.SHA) (gitpack.SHA, time.Time, error)
- func (s *Service) Get(ctx context.Context, repo Repo, sha gitpack.SHA) (gitpack.Type, []byte, error)
- func (s *Service) GetOp(ctx context.Context, ws string, kind OpKind, id string) ([]byte, error)
- func (s *Service) Has(ctx context.Context, repo Repo, shas []gitpack.SHA) ([]bool, error)
- func (s *Service) ImportPack(ctx context.Context, repo Repo, id string, idx, pack []byte) error
- func (s *Service) PutObjects(ctx context.Context, repo Repo, objs []gitpack.Object) ([]gitpack.SHA, error)
- func (s *Service) PutOp(ctx context.Context, ws string, kind OpKind, id string, data []byte) error
- func (s *Service) Slot(ctx context.Context, weight int64) (release func(), err error)
- func (s *Service) TreeBulk(ctx context.Context, repo Repo, sha gitpack.SHA, maxEntries int) ([]Tree, error)
- type Stats
- type Tree
Constants ¶
const ( MaxOpBytes = 8 << 20 MaxPackBytes = 64 << 20 MaxIdxBytes = 8 << 20 // MaxBlobBatchBytes bounds the blobs that one batch read returns. MaxBlobBatchBytes = 16 << 20 // MaxBatch bounds the objects of one put. MaxBatch = 100000 // SlotRead is the weight of a request that holds one object in memory. // SlotWrite is the weight of a request that holds a large body. SlotRead = 1 SlotWrite = slotCapacity )
Variables ¶
Functions ¶
func ValidWorkspaceID ¶
ValidWorkspaceID reports whether id can name a workspace.
Types ¶
type PackIndex ¶
type PackIndex interface {
AddPack(ctx context.Context, repo Repo, packID string, bytes int64) error
Packs(ctx context.Context, repo Repo) ([]PackRef, error)
}
PackIndex lists the packs of a repo, oldest first.
type Repo ¶
type Repo struct{ Prefix, Path string }
Repo names a repository as <prefix>:<path>.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service stores the objects of every repo and workspace in one object store.
func (*Service) Commit ¶
func (s *Service) Commit(ctx context.Context, repo Repo, sha gitpack.SHA) (gitpack.SHA, time.Time, error)
Commit returns the tree of a commit and its committer time.
func (*Service) Has ¶
Has reports for each sha whether a pack of the repo holds it. It reads the pack indexes only.
func (*Service) ImportPack ¶
ImportPack stores a pack and its v2 index under the SHA-256 of the pack.
func (*Service) PutObjects ¶
func (s *Service) PutObjects(ctx context.Context, repo Repo, objs []gitpack.Object) ([]gitpack.SHA, error)
PutObjects stores objects as one pack and returns their names in order.
type Stats ¶
type Stats struct {
Objects, Bytes, Packs, RangeReads, RangeBytes, MaxDepth, SlotWaitNanos atomic.Int64
}
Stats counts what one request read from the store. A handler puts one in the context with WithStats and reads it when the request ends. A nil *Stats counts nothing.
func (*Stats) AddSlotWait ¶
AddSlotWait adds the time a request waited for a weighted slot.