persistence

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoMatch = errors.New("no matching documents")

Functions

func ConnectToMongoDB added in v0.0.14

func ConnectToMongoDB(ctx context.Context, databaseConnected chan struct{}, databaseDisconnected chan struct{}, config MongoDBConfig) (file.FileMetadataRepository, error)

func CreateMongoDBClient

func CreateMongoDBClient(ctx context.Context, config MongoDBConfig) (*mongo.Client, error)

func EnsureDirectoryIsWritable added in v0.0.16

func EnsureDirectoryIsWritable(config PersistentVolumeConfig) error

func EnsurePathExists added in v0.0.16

func EnsurePathExists(config PersistentVolumeConfig) error

func PersistentVolumeListenToGracefulShutdown added in v0.0.16

func PersistentVolumeListenToGracefulShutdown(storageDisconnected chan struct{})

Types

type GoogleCloudStorageFileRepository added in v0.0.16

type GoogleCloudStorageFileRepository struct {
	Client *storage.Client
}

func ConnectToGoogleCloudStorage added in v0.0.16

func ConnectToGoogleCloudStorage(ctx context.Context, storageConnected chan struct{}, storageDisconnected chan struct{}, config GoogleCloundStorageConfig) (*GoogleCloudStorageFileRepository, error)

func (*GoogleCloudStorageFileRepository) CreateFile added in v0.0.16

func (g *GoogleCloudStorageFileRepository) CreateFile(ctx context.Context, fileId uuid.UUID, revisionId uuid.UUID) (io.WriteCloser, error)

func (*GoogleCloudStorageFileRepository) OpenFile added in v0.2.0

func (g *GoogleCloudStorageFileRepository) OpenFile(ctx context.Context, fileId uuid.UUID, revisionId uuid.UUID) (io.ReadCloser, error)

type GoogleCloundStorageConfig added in v0.0.16

type GoogleCloundStorageConfig struct {
}

type MongoDBConfig

type MongoDBConfig struct {
	HostUri                string
	DatabaseName           string
	FileMetadataCollection string
	Timeout                time.Duration
}

type MongoDBRepository

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

func NewMongoDBRepository

func NewMongoDBRepository(ctx context.Context, client *mongo.Client, databaseName string, collectionName string) (*MongoDBRepository, error)

func (*MongoDBRepository) FetchFileMetadata added in v0.2.0

func (repository *MongoDBRepository) FetchFileMetadata(ctx context.Context, fileId uuid.UUID) (file.FileMetadata, error)

func (*MongoDBRepository) NoMatchError added in v0.2.2

func (repository *MongoDBRepository) NoMatchError() error

func (*MongoDBRepository) NotFoundError added in v0.2.0

func (repository *MongoDBRepository) NotFoundError() error

func (*MongoDBRepository) StoreFileMetadata added in v0.0.8

func (repository *MongoDBRepository) StoreFileMetadata(ctx context.Context, fileMetadata file.FileMetadata) error

func (*MongoDBRepository) StoreRevision added in v0.2.2

func (repository *MongoDBRepository) StoreRevision(ctx context.Context, fileId uuid.UUID, revision file.Revision) error

type PersistentVolumeConfig added in v0.0.16

type PersistentVolumeConfig struct {
	Path string
}

type PersistentVolumeFileRepository added in v0.0.16

type PersistentVolumeFileRepository struct {
	StoragePath string
}

func ConnectToPersistentVolume added in v0.0.16

func ConnectToPersistentVolume(ctx context.Context, storageConnected chan struct{}, storageDisconnected chan struct{}, config PersistentVolumeConfig) (*PersistentVolumeFileRepository, error)

func (*PersistentVolumeFileRepository) CreateFile added in v0.0.16

func (g *PersistentVolumeFileRepository) CreateFile(ctx context.Context, fileId uuid.UUID, revisionId uuid.UUID) (io.WriteCloser, error)

func (*PersistentVolumeFileRepository) OpenFile added in v0.2.0

func (g *PersistentVolumeFileRepository) OpenFile(ctx context.Context, fileId uuid.UUID, revisionId uuid.UUID) (io.ReadCloser, error)

Jump to

Keyboard shortcuts

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