redis

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ObjectStore

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

ObjectStore implements Redis-based object storage

func NewObjectStore

func NewObjectStore(client redis.UniversalClient, config datastore.Config) *ObjectStore

NewObjectStore creates a new Redis object store

func (*ObjectStore) CountObjects

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

CountObjects returns the total number of objects

func (*ObjectStore) DeleteObject

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

DeleteObject removes an object

func (*ObjectStore) DeleteObjects

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

DeleteObjects removes multiple objects

func (*ObjectStore) GetObject

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

GetObject retrieves an object by hash

func (*ObjectStore) GetObjectSize

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

GetObjectSize returns the size of an object

func (*ObjectStore) GetObjects

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

GetObjects retrieves multiple objects

func (*ObjectStore) GetStorageSize

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

GetStorageSize returns the total storage used (approximate)

func (*ObjectStore) HasObject

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

HasObject checks if object exists

func (*ObjectStore) IterateObjects

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

IterateObjects iterates over objects matching a prefix

func (*ObjectStore) ListObjects

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

ListObjects lists objects matching a prefix

func (*ObjectStore) PutObject

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

PutObject stores an object

func (*ObjectStore) PutObjects

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

PutObjects stores multiple objects

type RedisStore

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

RedisStore implements DataStore using Redis (primarily for caching and sessions)

func New

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

New creates a new Redis-backed datastore

func (*RedisStore) BeginTx

BeginTx starts a new transaction (Redis has limited transaction support)

func (*RedisStore) Close

func (s *RedisStore) Close() error

Close closes the Redis connection

func (*RedisStore) GetMetrics

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

GetMetrics returns store metrics

func (*RedisStore) HealthCheck

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

HealthCheck verifies Redis is accessible

func (*RedisStore) Info

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

Info returns store information

func (*RedisStore) Initialize

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

Initialize initializes the Redis connection

func (*RedisStore) MetadataStore

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

MetadataStore returns a stub metadata store (Redis is primarily for object caching)

func (*RedisStore) ObjectStore

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

ObjectStore returns the object store interface

func (*RedisStore) Type

func (s *RedisStore) Type() string

Type returns the datastore type

type RedisTransaction

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

RedisTransaction implements limited transaction support for Redis Redis transactions are different from traditional ACID transactions

func NewRedisTransaction

func NewRedisTransaction(client redis.UniversalClient, ctx context.Context) *RedisTransaction

NewRedisTransaction creates a new Redis transaction

func (*RedisTransaction) Commit

func (tx *RedisTransaction) Commit() error

Commit commits the transaction

func (*RedisTransaction) CountEvents

func (tx *RedisTransaction) CountEvents(filter datastore.EventFilter) (int64, error)

CountEvents returns event count (Transaction interface requirement)

func (*RedisTransaction) CountObjects

func (tx *RedisTransaction) CountObjects() (int64, error)

CountObjects returns object count (Transaction interface requirement)

func (*RedisTransaction) DeleteConfig

func (tx *RedisTransaction) DeleteConfig(key string) error

DeleteConfig from Transaction interface

func (*RedisTransaction) DeleteObject

func (tx *RedisTransaction) DeleteObject(hash string) error

DeleteObject from Transaction interface

func (*RedisTransaction) DeleteObjects

func (tx *RedisTransaction) DeleteObjects(hashes []string) error

DeleteObjects from Transaction interface

func (*RedisTransaction) DeleteRef

func (tx *RedisTransaction) DeleteRef(repoID string, name string) error

DeleteRef from Transaction interface

func (*RedisTransaction) DeleteRepository

func (tx *RedisTransaction) DeleteRepository(id string) error

DeleteRepository from Transaction interface

func (*RedisTransaction) DeleteUser

func (tx *RedisTransaction) DeleteUser(id string) error

DeleteUser from Transaction interface

func (*RedisTransaction) GetAllConfig

func (tx *RedisTransaction) GetAllConfig() (map[string]string, error)

GetAllConfig from Transaction interface

func (*RedisTransaction) GetConfig

func (tx *RedisTransaction) GetConfig(key string) (string, error)

GetConfig from Transaction interface

func (*RedisTransaction) GetObject

func (tx *RedisTransaction) GetObject(hash string) ([]byte, error)

GetObject from Transaction interface

func (*RedisTransaction) GetObjectSize

func (tx *RedisTransaction) GetObjectSize(hash string) (int64, error)

GetObjectSize from Transaction interface

func (*RedisTransaction) GetObjects

func (tx *RedisTransaction) GetObjects(hashes []string) (map[string][]byte, error)

GetObjects from Transaction interface

func (*RedisTransaction) GetRef

func (tx *RedisTransaction) GetRef(repoID string, name string) (*datastore.Reference, error)

GetRef from Transaction interface

func (*RedisTransaction) GetRepository

func (tx *RedisTransaction) GetRepository(id string) (*datastore.Repository, error)

GetRepository from Transaction interface

func (*RedisTransaction) GetStorageSize

func (tx *RedisTransaction) GetStorageSize() (int64, error)

GetStorageSize from Transaction interface

func (*RedisTransaction) GetUser

func (tx *RedisTransaction) GetUser(id string) (*datastore.User, error)

GetUser from Transaction interface

func (*RedisTransaction) GetUserByUsername

func (tx *RedisTransaction) GetUserByUsername(username string) (*datastore.User, error)

GetUserByUsername from Transaction interface

func (*RedisTransaction) HasObject

func (tx *RedisTransaction) HasObject(hash string) (bool, error)

HasObject from Transaction interface

func (*RedisTransaction) IterateObjects

func (tx *RedisTransaction) IterateObjects(prefix string, fn func(hash string, data []byte) error) error

IterateObjects from Transaction interface

func (*RedisTransaction) ListObjects

func (tx *RedisTransaction) ListObjects(prefix string, limit int) ([]string, error)

ListObjects from Transaction interface

func (*RedisTransaction) ListRefs

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

ListRefs from Transaction interface

func (*RedisTransaction) ListRepositories

func (tx *RedisTransaction) ListRepositories(filter datastore.RepositoryFilter) ([]*datastore.Repository, error)

ListRepositories from Transaction interface

func (*RedisTransaction) ListUsers

func (tx *RedisTransaction) ListUsers(filter datastore.UserFilter) ([]*datastore.User, error)

ListUsers from Transaction interface

func (*RedisTransaction) LogEvent

func (tx *RedisTransaction) LogEvent(event *datastore.AuditEvent) error

LogEvent from Transaction interface

func (*RedisTransaction) MetadataStore

func (tx *RedisTransaction) MetadataStore() datastore.MetadataStore

MetadataStore returns the transaction metadata store (stub)

func (*RedisTransaction) ObjectStore

func (tx *RedisTransaction) ObjectStore() datastore.ObjectStore

ObjectStore returns the transaction object store

func (*RedisTransaction) PutObject

func (tx *RedisTransaction) PutObject(hash string, data []byte) error

PutObject from Transaction interface

func (*RedisTransaction) PutObjects

func (tx *RedisTransaction) PutObjects(objects map[string][]byte) error

PutObjects from Transaction interface

func (*RedisTransaction) QueryEvents

func (tx *RedisTransaction) QueryEvents(filter datastore.EventFilter) ([]*datastore.AuditEvent, error)

QueryEvents from Transaction interface

func (*RedisTransaction) Rollback

func (tx *RedisTransaction) Rollback() error

Rollback rolls back the transaction (Redis doesn't support rollback, so this is a no-op)

func (*RedisTransaction) SaveRef

func (tx *RedisTransaction) SaveRef(repoID string, ref *datastore.Reference) error

SaveRef from Transaction interface

func (*RedisTransaction) SaveRepository

func (tx *RedisTransaction) SaveRepository(repo *datastore.Repository) error

SaveRepository from Transaction interface

func (*RedisTransaction) SaveUser

func (tx *RedisTransaction) SaveUser(user *datastore.User) error

SaveUser from Transaction interface

func (*RedisTransaction) SetConfig

func (tx *RedisTransaction) SetConfig(key string, value string) error

SetConfig from Transaction interface

func (*RedisTransaction) UpdateRef

func (tx *RedisTransaction) UpdateRef(repoID string, name string, newHash string) error

UpdateRef from Transaction interface

func (*RedisTransaction) UpdateRepository

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

UpdateRepository from Transaction interface

func (*RedisTransaction) UpdateUser

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

UpdateUser from Transaction interface

type StubMetadataStore

type StubMetadataStore struct{}

StubMetadataStore provides minimal metadata store implementation for Redis Redis is primarily used for caching and sessions, not metadata storage

func (*StubMetadataStore) CountEvents

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

func (*StubMetadataStore) DeleteConfig

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

func (*StubMetadataStore) DeleteRef

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

func (*StubMetadataStore) DeleteRepository

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

func (*StubMetadataStore) DeleteUser

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

func (*StubMetadataStore) GetAllConfig

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

func (*StubMetadataStore) GetConfig

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

func (*StubMetadataStore) GetRef

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

func (*StubMetadataStore) GetRepository

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

func (*StubMetadataStore) GetUser

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

func (*StubMetadataStore) GetUserByUsername

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

func (*StubMetadataStore) ListRefs

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

func (*StubMetadataStore) ListRepositories

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

func (*StubMetadataStore) ListUsers

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

func (*StubMetadataStore) LogEvent

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

func (*StubMetadataStore) QueryEvents

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

func (*StubMetadataStore) SaveAuditEvent

func (s *StubMetadataStore) SaveAuditEvent(event *datastore.AuditEvent) error

func (*StubMetadataStore) SaveRef

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

func (*StubMetadataStore) SaveRepository

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

func (*StubMetadataStore) SaveUser

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

func (*StubMetadataStore) SetConfig

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

func (*StubMetadataStore) UpdateRef

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

func (*StubMetadataStore) UpdateRepository

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

func (*StubMetadataStore) UpdateUser

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

type TransactionMetadataStore

type TransactionMetadataStore struct{}

TransactionMetadataStore provides stub metadata operations for transactions

func (*TransactionMetadataStore) CountEvents

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

func (*TransactionMetadataStore) DeleteConfig

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

func (*TransactionMetadataStore) DeleteRef

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

func (*TransactionMetadataStore) DeleteRepository

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

func (*TransactionMetadataStore) DeleteUser

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

func (*TransactionMetadataStore) GetAllConfig

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

func (*TransactionMetadataStore) GetConfig

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

func (*TransactionMetadataStore) GetRef

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

func (*TransactionMetadataStore) GetRepository

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

func (*TransactionMetadataStore) GetUser

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

func (*TransactionMetadataStore) GetUserByUsername

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

func (*TransactionMetadataStore) ListRefs

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

func (*TransactionMetadataStore) ListRepositories

func (*TransactionMetadataStore) ListUsers

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

func (*TransactionMetadataStore) LogEvent

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

func (*TransactionMetadataStore) QueryEvents

func (*TransactionMetadataStore) SaveAuditEvent

func (s *TransactionMetadataStore) SaveAuditEvent(event *datastore.AuditEvent) error

func (*TransactionMetadataStore) SaveRef

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

func (*TransactionMetadataStore) SaveRepository

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

func (*TransactionMetadataStore) SaveUser

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

func (*TransactionMetadataStore) SetConfig

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

func (*TransactionMetadataStore) UpdateRef

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

func (*TransactionMetadataStore) UpdateRepository

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

func (*TransactionMetadataStore) UpdateUser

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

type TransactionObjectStore

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

TransactionObjectStore implements object operations within a Redis transaction

func (*TransactionObjectStore) CountObjects

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

CountObjects returns object count (not supported in transaction)

func (*TransactionObjectStore) DeleteObject

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

DeleteObject removes an object within transaction

func (*TransactionObjectStore) DeleteObjects

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

DeleteObjects removes multiple objects within transaction

func (*TransactionObjectStore) GetObject

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

GetObject retrieves an object (uses GET within transaction)

func (*TransactionObjectStore) GetObjectSize

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

GetObjectSize returns object size (not supported in transaction)

func (*TransactionObjectStore) GetObjects

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

GetObjects retrieves multiple objects (not supported in transaction)

func (*TransactionObjectStore) GetStorageSize

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

GetStorageSize returns storage size (not supported in transaction)

func (*TransactionObjectStore) HasObject

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

HasObject checks existence (not supported in transaction)

func (*TransactionObjectStore) IterateObjects

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

IterateObjects iterates objects (not supported in transaction)

func (*TransactionObjectStore) ListObjects

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

ListObjects lists objects (not supported in transaction)

func (*TransactionObjectStore) PutObject

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

PutObject stores an object within transaction

func (*TransactionObjectStore) PutObjects

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

PutObjects stores multiple objects within transaction

Jump to

Keyboard shortcuts

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