badger

package
v0.0.0-...-dc8f43e Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package badger implements a BadgerDB-backed datastore for govc. BadgerDB is an embedded, persistent key-value database optimized for SSD. It's particularly well-suited for Git objects due to its LSM-tree architecture.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadgerStore

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

BadgerStore implements datastore.DataStore using BadgerDB

func New

func New(config datastore.Config) (*BadgerStore, error)

New creates a new BadgerDB store

func (*BadgerStore) BeginTx

BeginTx begins a transaction

func (*BadgerStore) Close

func (s *BadgerStore) Close() error

Close closes the BadgerDB store

func (*BadgerStore) CountEvents

func (s *BadgerStore) CountEvents(filter datastore.EventFilter) (int64, error)

CountEvents counts audit events

func (*BadgerStore) CountObjects

func (s *BadgerStore) CountObjects() (int64, error)

CountObjects returns the total number of objects

func (*BadgerStore) DeleteConfig

func (s *BadgerStore) DeleteConfig(key string) error

DeleteConfig deletes a configuration key

func (*BadgerStore) DeleteObject

func (s *BadgerStore) DeleteObject(hash string) error

DeleteObject deletes an object

func (*BadgerStore) DeleteObjects

func (s *BadgerStore) DeleteObjects(hashes []string) error

DeleteObjects deletes multiple objects at once

func (*BadgerStore) DeleteRef

func (s *BadgerStore) DeleteRef(repoID string, name string) error

DeleteRef deletes a reference

func (*BadgerStore) DeleteRepository

func (s *BadgerStore) DeleteRepository(id string) error

DeleteRepository deletes a repository

func (*BadgerStore) DeleteUser

func (s *BadgerStore) DeleteUser(id string) error

DeleteUser deletes a user

func (*BadgerStore) GetAllConfig

func (s *BadgerStore) GetAllConfig() (map[string]string, error)

GetAllConfig retrieves all configuration

func (*BadgerStore) GetConfig

func (s *BadgerStore) GetConfig(key string) (string, error)

GetConfig retrieves a configuration value

func (*BadgerStore) GetMetrics

func (s *BadgerStore) GetMetrics() datastore.Metrics

GetMetrics returns store metrics

func (*BadgerStore) GetObject

func (s *BadgerStore) GetObject(hash string) ([]byte, error)

GetObject retrieves an object by hash

func (*BadgerStore) GetObjectSize

func (s *BadgerStore) GetObjectSize(hash string) (int64, error)

GetObjectSize returns the size of an object

func (*BadgerStore) GetObjects

func (s *BadgerStore) GetObjects(hashes []string) (map[string][]byte, error)

GetObjects retrieves multiple objects at once

func (*BadgerStore) GetRef

func (s *BadgerStore) GetRef(repoID string, name string) (*datastore.Reference, error)

GetRef retrieves a reference

func (*BadgerStore) GetRepository

func (s *BadgerStore) GetRepository(id string) (*datastore.Repository, error)

GetRepository retrieves a repository by ID

func (*BadgerStore) GetStorageSize

func (s *BadgerStore) GetStorageSize() (int64, error)

GetStorageSize returns the total storage size used

func (*BadgerStore) GetUser

func (s *BadgerStore) GetUser(id string) (*datastore.User, error)

GetUser retrieves a user by ID

func (*BadgerStore) GetUserByUsername

func (s *BadgerStore) GetUserByUsername(username string) (*datastore.User, error)

GetUserByUsername retrieves a user by username

func (*BadgerStore) HasObject

func (s *BadgerStore) HasObject(hash string) (bool, error)

HasObject checks if an object exists

func (*BadgerStore) HealthCheck

func (s *BadgerStore) HealthCheck(ctx context.Context) error

HealthCheck checks if the store is healthy

func (*BadgerStore) Info

func (s *BadgerStore) Info() map[string]interface{}

Info returns store information

func (*BadgerStore) Initialize

func (s *BadgerStore) Initialize(config datastore.Config) error

Initialize initializes the BadgerDB store

func (*BadgerStore) IterateObjects

func (s *BadgerStore) IterateObjects(prefix string, fn func(hash string, data []byte) error) error

IterateObjects iterates over objects

func (*BadgerStore) ListObjects

func (s *BadgerStore) ListObjects(prefix string, limit int) ([]string, error)

ListObjects lists objects with optional prefix filtering

func (*BadgerStore) ListRefs

func (s *BadgerStore) ListRefs(repoID string, refType datastore.RefType) ([]*datastore.Reference, error)

ListRefs lists references for a repository

func (*BadgerStore) ListRepositories

func (s *BadgerStore) ListRepositories(filter datastore.RepositoryFilter) ([]*datastore.Repository, error)

ListRepositories lists repositories with filtering

func (*BadgerStore) ListUsers

func (s *BadgerStore) ListUsers(filter datastore.UserFilter) ([]*datastore.User, error)

ListUsers lists users with filtering

func (*BadgerStore) LogEvent

func (s *BadgerStore) LogEvent(event *datastore.AuditEvent) error

LogEvent logs an audit event

func (*BadgerStore) MetadataStore

func (s *BadgerStore) MetadataStore() datastore.MetadataStore

MetadataStore returns the metadata store interface

func (*BadgerStore) ObjectStore

func (s *BadgerStore) ObjectStore() datastore.ObjectStore

ObjectStore returns the object store interface

func (*BadgerStore) PutObject

func (s *BadgerStore) PutObject(hash string, data []byte) error

PutObject stores an object

func (*BadgerStore) PutObjects

func (s *BadgerStore) PutObjects(objects map[string][]byte) error

PutObjects stores multiple objects at once

func (*BadgerStore) QueryEvents

func (s *BadgerStore) QueryEvents(filter datastore.EventFilter) ([]*datastore.AuditEvent, error)

QueryEvents queries audit events

func (*BadgerStore) SaveRef

func (s *BadgerStore) SaveRef(repoID string, ref *datastore.Reference) error

SaveRef saves a reference

func (*BadgerStore) SaveRepository

func (s *BadgerStore) SaveRepository(repo *datastore.Repository) error

SaveRepository saves a repository

func (*BadgerStore) SaveUser

func (s *BadgerStore) SaveUser(user *datastore.User) error

SaveUser saves a user

func (*BadgerStore) SetConfig

func (s *BadgerStore) SetConfig(key string, value string) error

SetConfig sets a configuration value

func (*BadgerStore) Type

func (s *BadgerStore) Type() string

Type returns the store type

func (*BadgerStore) UpdateRef

func (s *BadgerStore) UpdateRef(repoID string, name string, newHash string) error

UpdateRef updates a reference hash

func (*BadgerStore) UpdateRepository

func (s *BadgerStore) UpdateRepository(id string, updates map[string]interface{}) error

UpdateRepository updates a repository

func (*BadgerStore) UpdateUser

func (s *BadgerStore) UpdateUser(id string, updates map[string]interface{}) error

UpdateUser updates a user

func (*BadgerStore) Vacuum

func (s *BadgerStore) Vacuum() error

Vacuum optimizes the database

Jump to

Keyboard shortcuts

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