Documentation
¶
Index ¶
- type Backend
- type Error
- type FileBackend
- type HybridObjectStore
- func (s *HybridObjectStore) Close() error
- func (s *HybridObjectStore) Exists(hash string) bool
- func (s *HybridObjectStore) Get(hash string) (object.Object, error)
- func (s *HybridObjectStore) List() ([]string, error)
- func (s *HybridObjectStore) Put(obj object.Object) (string, error)
- func (s *HybridObjectStore) Size() (int64, error)
- type HybridStorageFactory
- type MemoryBackend
- type MemoryObjectStore
- func (s *MemoryObjectStore) Close() error
- func (s *MemoryObjectStore) Exists(hash string) bool
- func (s *MemoryObjectStore) Get(hash string) (object.Object, error)
- func (s *MemoryObjectStore) List() ([]string, error)
- func (s *MemoryObjectStore) Put(obj object.Object) (string, error)
- func (s *MemoryObjectStore) Size() (int64, error)
- type MemoryRefStore
- func (s *MemoryRefStore) Close() error
- func (s *MemoryRefStore) DeleteRef(name string) error
- func (s *MemoryRefStore) GetHEAD() (string, error)
- func (s *MemoryRefStore) GetRef(name string) (string, error)
- func (s *MemoryRefStore) ListRefs() (map[string]string, error)
- func (s *MemoryRefStore) SetHEAD(target string) error
- func (s *MemoryRefStore) UpdateRef(name string, hash string) error
- type MemoryStorageFactory
- type MemoryWorkingStorage
- func (s *MemoryWorkingStorage) Clear() error
- func (s *MemoryWorkingStorage) Close() error
- func (s *MemoryWorkingStorage) Delete(path string) error
- func (s *MemoryWorkingStorage) Exists(path string) bool
- func (s *MemoryWorkingStorage) List() ([]string, error)
- func (s *MemoryWorkingStorage) Read(path string) ([]byte, error)
- func (s *MemoryWorkingStorage) Write(path string, data []byte) error
- type ObjectStore
- type ObjectStoreConfig
- type PackFile
- type PackedObject
- type RefManagerAdapter
- func (a *RefManagerAdapter) Close() error
- func (a *RefManagerAdapter) DeleteRef(name string) error
- func (a *RefManagerAdapter) GetHEAD() (string, error)
- func (a *RefManagerAdapter) GetRef(name string) (string, error)
- func (a *RefManagerAdapter) ListRefs() (map[string]string, error)
- func (a *RefManagerAdapter) SetHEAD(target string) error
- func (a *RefManagerAdapter) UpdateRef(name string, hash string) error
- type RefStore
- type RefStoreConfig
- type RefsStoreAdapter
- func (a *RefsStoreAdapter) Close() error
- func (a *RefsStoreAdapter) DeleteRef(name string) error
- func (a *RefsStoreAdapter) GetHEAD() (string, error)
- func (a *RefsStoreAdapter) GetRef(name string) (string, error)
- func (a *RefsStoreAdapter) ListRefs() (map[string]string, error)
- func (a *RefsStoreAdapter) SetHEAD(target string) error
- func (a *RefsStoreAdapter) UpdateRef(name string, hash string) error
- type StorageFactory
- type Store
- func (s *Store) GetAllObjects() ([]object.Object, error)
- func (s *Store) GetBlob(hash string) (*object.Blob, error)
- func (s *Store) GetCommit(hash string) (*object.Commit, error)
- func (s *Store) GetObject(hash string) (object.Object, error)
- func (s *Store) GetTag(hash string) (*object.Tag, error)
- func (s *Store) GetTree(hash string) (*object.Tree, error)
- func (s *Store) HasObject(hash string) bool
- func (s *Store) ListObjects() ([]string, error)
- func (s *Store) ReadPack(r io.Reader) error
- func (s *Store) SetMemoryPool(pool interface{})
- func (s *Store) StoreBlob(content []byte) (string, error)
- func (s *Store) StoreCommit(commit *object.Commit) (string, error)
- func (s *Store) StoreObject(obj object.Object) (string, error)
- func (s *Store) StoreTag(tag *object.Tag) (string, error)
- func (s *Store) StoreTree(tree *object.Tree) (string, error)
- func (s *Store) WritePack(w io.Writer, hashes []string) error
- type StoreAdapter
- func (a *StoreAdapter) Close() error
- func (a *StoreAdapter) Exists(hash string) bool
- func (a *StoreAdapter) Get(hash string) (object.Object, error)
- func (a *StoreAdapter) List() ([]string, error)
- func (a *StoreAdapter) Put(obj object.Object) (string, error)
- func (a *StoreAdapter) Size() (int64, error)
- type WorkingStorage
- type WorkingStorageConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct { Type string // "not_found", "invalid_object", "io_error", etc. Message string Cause error }
Errors for storage operations
func InvalidObjectError ¶
type FileBackend ¶
type FileBackend struct {
// contains filtered or unexported fields
}
func NewFileBackend ¶
func NewFileBackend(path string) *FileBackend
func (*FileBackend) HasObject ¶
func (f *FileBackend) HasObject(hash string) bool
func (*FileBackend) ListObjects ¶
func (f *FileBackend) ListObjects() ([]string, error)
func (*FileBackend) ReadObject ¶
func (f *FileBackend) ReadObject(hash string) ([]byte, error)
func (*FileBackend) WriteObject ¶
func (f *FileBackend) WriteObject(hash string, data []byte) error
type HybridObjectStore ¶
type HybridObjectStore struct {
// contains filtered or unexported fields
}
HybridObjectStore implements memory-first storage with disk backup Objects are kept in memory for speed but also persisted to disk
func NewHybridObjectStore ¶
func NewHybridObjectStore(diskPath string, maxMemory int64) (*HybridObjectStore, error)
NewHybridObjectStore creates a memory-first object store with disk backup
func (*HybridObjectStore) Close ¶
func (s *HybridObjectStore) Close() error
func (*HybridObjectStore) Exists ¶
func (s *HybridObjectStore) Exists(hash string) bool
func (*HybridObjectStore) List ¶
func (s *HybridObjectStore) List() ([]string, error)
func (*HybridObjectStore) Size ¶
func (s *HybridObjectStore) Size() (int64, error)
type HybridStorageFactory ¶
type HybridStorageFactory struct {
// contains filtered or unexported fields
}
HybridStorageFactory creates hybrid storage instances
func NewHybridStorageFactory ¶
func NewHybridStorageFactory(basePath string) *HybridStorageFactory
NewHybridStorageFactory creates a new hybrid storage factory
func (*HybridStorageFactory) CreateObjectStore ¶
func (f *HybridStorageFactory) CreateObjectStore(config ObjectStoreConfig) (ObjectStore, error)
func (*HybridStorageFactory) CreateRefStore ¶
func (f *HybridStorageFactory) CreateRefStore(config RefStoreConfig) (RefStore, error)
func (*HybridStorageFactory) CreateWorkingStorage ¶
func (f *HybridStorageFactory) CreateWorkingStorage(config WorkingStorageConfig) (WorkingStorage, error)
type MemoryBackend ¶
type MemoryBackend struct {
// contains filtered or unexported fields
}
MemoryBackend stores all Git objects in memory. This is the foundation of govc's memory-first approach - no disk I/O means operations complete in microseconds instead of milliseconds. Creating 1000 branches? That's just creating 1000 pointers in a map.
func NewMemoryBackend ¶
func NewMemoryBackend() *MemoryBackend
func (*MemoryBackend) HasObject ¶
func (m *MemoryBackend) HasObject(hash string) bool
func (*MemoryBackend) ListObjects ¶
func (m *MemoryBackend) ListObjects() ([]string, error)
func (*MemoryBackend) ReadObject ¶
func (m *MemoryBackend) ReadObject(hash string) ([]byte, error)
func (*MemoryBackend) WriteObject ¶
func (m *MemoryBackend) WriteObject(hash string, data []byte) error
type MemoryObjectStore ¶
type MemoryObjectStore struct {
// contains filtered or unexported fields
}
MemoryObjectStore implements ObjectStore in memory
func NewMemoryObjectStore ¶
func NewMemoryObjectStore() *MemoryObjectStore
NewMemoryObjectStore creates a new in-memory object store
func (*MemoryObjectStore) Close ¶
func (s *MemoryObjectStore) Close() error
func (*MemoryObjectStore) Exists ¶
func (s *MemoryObjectStore) Exists(hash string) bool
func (*MemoryObjectStore) List ¶
func (s *MemoryObjectStore) List() ([]string, error)
func (*MemoryObjectStore) Size ¶
func (s *MemoryObjectStore) Size() (int64, error)
type MemoryRefStore ¶
type MemoryRefStore struct {
// contains filtered or unexported fields
}
MemoryRefStore implements RefStore in memory
func NewMemoryRefStore ¶
func NewMemoryRefStore() *MemoryRefStore
NewMemoryRefStore creates a new in-memory reference store
func (*MemoryRefStore) Close ¶
func (s *MemoryRefStore) Close() error
func (*MemoryRefStore) DeleteRef ¶
func (s *MemoryRefStore) DeleteRef(name string) error
func (*MemoryRefStore) GetHEAD ¶
func (s *MemoryRefStore) GetHEAD() (string, error)
func (*MemoryRefStore) SetHEAD ¶
func (s *MemoryRefStore) SetHEAD(target string) error
type MemoryStorageFactory ¶
type MemoryStorageFactory struct{}
MemoryStorageFactory creates memory-based storage instances
func NewMemoryStorageFactory ¶
func NewMemoryStorageFactory() *MemoryStorageFactory
NewMemoryStorageFactory creates a new memory storage factory
func (*MemoryStorageFactory) CreateObjectStore ¶
func (f *MemoryStorageFactory) CreateObjectStore(config ObjectStoreConfig) (ObjectStore, error)
func (*MemoryStorageFactory) CreateRefStore ¶
func (f *MemoryStorageFactory) CreateRefStore(config RefStoreConfig) (RefStore, error)
func (*MemoryStorageFactory) CreateWorkingStorage ¶
func (f *MemoryStorageFactory) CreateWorkingStorage(config WorkingStorageConfig) (WorkingStorage, error)
type MemoryWorkingStorage ¶
type MemoryWorkingStorage struct {
// contains filtered or unexported fields
}
MemoryWorkingStorage implements WorkingStorage in memory
func NewMemoryWorkingStorage ¶
func NewMemoryWorkingStorage() *MemoryWorkingStorage
NewMemoryWorkingStorage creates a new in-memory working storage
func (*MemoryWorkingStorage) Clear ¶
func (s *MemoryWorkingStorage) Clear() error
func (*MemoryWorkingStorage) Close ¶
func (s *MemoryWorkingStorage) Close() error
func (*MemoryWorkingStorage) Delete ¶
func (s *MemoryWorkingStorage) Delete(path string) error
func (*MemoryWorkingStorage) Exists ¶
func (s *MemoryWorkingStorage) Exists(path string) bool
func (*MemoryWorkingStorage) List ¶
func (s *MemoryWorkingStorage) List() ([]string, error)
type ObjectStore ¶
type ObjectStore interface { // Get retrieves an object by its hash Get(hash string) (object.Object, error) // Put stores an object and returns its hash Put(obj object.Object) (string, error) // Exists checks if an object exists without retrieving it Exists(hash string) bool // List returns all object hashes (for debugging/maintenance) List() ([]string, error) // Size returns the storage size metrics Size() (int64, error) // Close releases any resources held by the store Close() error }
ObjectStore handles immutable Git objects (commits, trees, blobs) This is the core of Git's content-addressable storage
func NewFileObjectStore ¶
func NewFileObjectStore(path string) ObjectStore
NewFileObjectStore creates a file-backed ObjectStore
func NewMemoryObjectStoreFromStore ¶
func NewMemoryObjectStoreFromStore() ObjectStore
NewMemoryObjectStoreFromStore creates a memory-only ObjectStore
func NewObjectStoreFromBackend ¶
func NewObjectStoreFromBackend(backend Backend) ObjectStore
NewObjectStoreFromBackend creates an ObjectStore from a Backend
type ObjectStoreConfig ¶
type PackFile ¶
type PackFile struct { Version uint32 NumObjects uint32 Objects []PackedObject }
type PackedObject ¶
type RefManagerAdapter ¶
type RefManagerAdapter struct {
// contains filtered or unexported fields
}
RefManagerAdapter adapts the existing RefManager to implement storage.RefStore interface This provides backward compatibility while transitioning to the new architecture
func NewRefManagerAdapter ¶
func NewRefManagerAdapter(manager *refs.RefManager) *RefManagerAdapter
NewRefManagerAdapter creates a RefStore adapter for the existing RefManager
func (*RefManagerAdapter) Close ¶
func (a *RefManagerAdapter) Close() error
func (*RefManagerAdapter) DeleteRef ¶
func (a *RefManagerAdapter) DeleteRef(name string) error
func (*RefManagerAdapter) GetHEAD ¶
func (a *RefManagerAdapter) GetHEAD() (string, error)
func (*RefManagerAdapter) ListRefs ¶
func (a *RefManagerAdapter) ListRefs() (map[string]string, error)
func (*RefManagerAdapter) SetHEAD ¶
func (a *RefManagerAdapter) SetHEAD(target string) error
type RefStore ¶
type RefStore interface { // GetRef returns the hash that a reference points to GetRef(name string) (string, error) // UpdateRef updates a reference to point to a new hash UpdateRef(name string, hash string) error // DeleteRef removes a reference DeleteRef(name string) error // ListRefs returns all references with their target hashes ListRefs() (map[string]string, error) // GetHEAD returns what HEAD points to (branch name or commit hash) GetHEAD() (string, error) // SetHEAD updates HEAD to point to a branch or commit SetHEAD(target string) error // Close releases any resources held by the store Close() error }
RefStore handles mutable references (branches, tags, HEAD) These are pointers to commits in the object store
func NewFileRefStore ¶
NewFileRefStore creates a file-backed RefStore using the refs package
func NewFileRefStoreAdapter ¶
NewFileRefStoreAdapter creates a file-backed RefStore using refs.FileRefStore
func NewMemoryRefStoreAdapter ¶
func NewMemoryRefStoreAdapter() RefStore
NewMemoryRefStoreAdapter creates a memory-only RefStore using refs.MemoryRefStore
func NewMemoryRefStoreFromRefs ¶
func NewMemoryRefStoreFromRefs() RefStore
NewMemoryRefStoreFromRefs creates a memory-only RefStore using the refs package
func NewRefStoreFromRefsStore ¶
NewRefStoreFromRefsStore creates a storage.RefStore from a refs.RefStore
type RefStoreConfig ¶
type RefsStoreAdapter ¶
type RefsStoreAdapter struct {
// contains filtered or unexported fields
}
RefsStoreAdapter adapts refs.RefStore to implement storage.RefStore interface This provides a more direct bridge between the two interfaces
func NewRefsStoreAdapter ¶
func NewRefsStoreAdapter(store refs.RefStore) *RefsStoreAdapter
NewRefsStoreAdapter creates a storage.RefStore adapter for refs.RefStore
func (*RefsStoreAdapter) Close ¶
func (a *RefsStoreAdapter) Close() error
func (*RefsStoreAdapter) DeleteRef ¶
func (a *RefsStoreAdapter) DeleteRef(name string) error
func (*RefsStoreAdapter) GetHEAD ¶
func (a *RefsStoreAdapter) GetHEAD() (string, error)
func (*RefsStoreAdapter) ListRefs ¶
func (a *RefsStoreAdapter) ListRefs() (map[string]string, error)
func (*RefsStoreAdapter) SetHEAD ¶
func (a *RefsStoreAdapter) SetHEAD(target string) error
type StorageFactory ¶
type StorageFactory interface { // CreateObjectStore creates an object store with the given configuration CreateObjectStore(config ObjectStoreConfig) (ObjectStore, error) // CreateRefStore creates a reference store with the given configuration CreateRefStore(config RefStoreConfig) (RefStore, error) // CreateWorkingStorage creates working storage with the given configuration CreateWorkingStorage(config WorkingStorageConfig) (WorkingStorage, error) }
StorageFactory creates storage instances This allows different storage backends (memory, disk, hybrid)
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store provides a unified interface to Git objects. The key innovation: cache isn't just for performance, it's the primary storage layer. The backend is optional - you can run entirely in memory. This enables use cases like testing infrastructure changes without ever touching disk.
func (*Store) GetAllObjects ¶
GetAllObjects returns all objects in the store
func (*Store) ListObjects ¶
func (*Store) SetMemoryPool ¶
func (s *Store) SetMemoryPool(pool interface{})
SetMemoryPool sets the memory pool for optimized allocations
type StoreAdapter ¶
type StoreAdapter struct {
// contains filtered or unexported fields
}
StoreAdapter adapts the existing Store to implement ObjectStore interface This provides backward compatibility while transitioning to the new architecture
func NewStoreAdapter ¶
func NewStoreAdapter(store *Store) *StoreAdapter
NewStoreAdapter creates an ObjectStore adapter for the existing Store
func (*StoreAdapter) Close ¶
func (a *StoreAdapter) Close() error
func (*StoreAdapter) Exists ¶
func (a *StoreAdapter) Exists(hash string) bool
func (*StoreAdapter) List ¶
func (a *StoreAdapter) List() ([]string, error)
func (*StoreAdapter) Size ¶
func (a *StoreAdapter) Size() (int64, error)
type WorkingStorage ¶
type WorkingStorage interface { // Read retrieves file content from the working directory Read(path string) ([]byte, error) // Write stores file content in the working directory Write(path string, data []byte) error // Delete removes a file from the working directory Delete(path string) error // List returns all files in the working directory List() ([]string, error) // Clear removes all files from the working directory Clear() error // Exists checks if a file exists Exists(path string) bool // Close releases any resources held by the storage Close() error }
WorkingStorage handles mutable working directory content This is separate from Git objects and can be cleared/restored