Documentation ¶
Index ¶
- Variables
- func New(ctx context.Context, conf DatabaseConfig) (domain.Databaser, error)
- type Badger
- func (b *Badger) AlbumsToBeDeleted(_ context.Context) ([]model.Album, error)
- func (b *Badger) Close(_ context.Context) error
- func (b *Badger) CountImages(_ context.Context, album uint64) (int, error)
- func (b *Badger) CountImagesCompressed(_ context.Context, album uint64) (int, error)
- func (b *Badger) DeleteAlbum(_ context.Context, album uint64) error
- func (b *Badger) GetEdges(_ context.Context, album uint64) (map[uint64]map[uint64]int, error)
- func (b *Badger) GetImageSrc(_ context.Context, album uint64, image uint64) (string, error)
- func (b *Badger) GetImagesIds(_ context.Context, album uint64) ([]uint64, error)
- func (b *Badger) GetImagesOrdered(_ context.Context, album uint64) ([]model.Image, error)
- func (b *Badger) Health(_ context.Context) (bool, error)
- func (b *Badger) Monitor(ctx context.Context)
- func (b *Badger) Reset() error
- func (b *Badger) SaveAlbum(_ context.Context, alb model.Album) error
- func (b *Badger) SaveVote(_ context.Context, album uint64, imageFrom uint64, imageTo uint64) error
- func (b *Badger) UpdateCompressionStatus(_ context.Context, album uint64, image uint64) error
- func (b *Badger) UpdateRatings(_ context.Context, album uint64, vector map[uint64]float64) error
- type BadgerConfig
- type DatabaseConfig
- type Mem
- func (m *Mem) AlbumsToBeDeleted(_ context.Context) ([]model.Album, error)
- func (m *Mem) CountImages(_ context.Context, album uint64) (int, error)
- func (m *Mem) CountImagesCompressed(_ context.Context, album uint64) (int, error)
- func (m *Mem) DeleteAlbum(_ context.Context, album uint64) error
- func (m *Mem) GetEdges(_ context.Context, album uint64) (map[uint64]map[uint64]int, error)
- func (m *Mem) GetImageSrc(_ context.Context, album uint64, image uint64) (string, error)
- func (m *Mem) GetImagesIds(_ context.Context, album uint64) ([]uint64, error)
- func (m *Mem) GetImagesOrdered(_ context.Context, album uint64) ([]model.Image, error)
- func (m *Mem) Health(_ context.Context) (bool, error)
- func (m *Mem) Reset() error
- func (m *Mem) SaveAlbum(_ context.Context, alb model.Album) error
- func (m *Mem) SaveVote(_ context.Context, album uint64, imageFrom uint64, imageTo uint64) error
- func (m *Mem) UpdateCompressionStatus(_ context.Context, album uint64, image uint64) error
- func (m *Mem) UpdateRatings(_ context.Context, album uint64, vector map[uint64]float64) error
- type MemConfig
- type Mongo
- func (m *Mongo) AlbumsToBeDeleted(ctx context.Context) ([]model.Album, error)
- func (m *Mongo) Close(ctx context.Context) error
- func (m *Mongo) CountImages(ctx context.Context, album uint64) (int, error)
- func (m *Mongo) CountImagesCompressed(ctx context.Context, album uint64) (int, error)
- func (m *Mongo) DeleteAlbum(ctx context.Context, album uint64) error
- func (m *Mongo) GetEdges(ctx context.Context, album uint64) (map[uint64]map[uint64]int, error)
- func (m *Mongo) GetImageSrc(ctx context.Context, album uint64, image uint64) (string, error)
- func (m *Mongo) GetImagesIds(ctx context.Context, album uint64) ([]uint64, error)
- func (m *Mongo) GetImagesOrdered(ctx context.Context, album uint64) ([]model.Image, error)
- func (m *Mongo) Health(ctx context.Context) (bool, error)
- func (m *Mongo) Reset() error
- func (m *Mongo) SaveAlbum(ctx context.Context, alb model.Album) error
- func (m *Mongo) SaveVote(ctx context.Context, album uint64, imageFrom uint64, imageTo uint64) error
- func (m *Mongo) UpdateCompressionStatus(ctx context.Context, album uint64, image uint64) error
- func (m *Mongo) UpdateRatings(ctx context.Context, album uint64, vector map[uint64]float64) error
- type MongoConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultMemConfig = MemConfig{ Compressed: false, } DefaultMongoConfig = MongoConfig{ Host: "localhost", Port: "27017", RetryTimes: 4, RetryPause: 5 * time.Second, Timeout: 30 * time.Second, LRU: 1, Compressed: false, } DefaultBadgerConfig = BadgerConfig{ InMemory: true, GcRatio: 0, CleanupInterval: 0, LRU: 1, Compressed: false, } )
Functions ¶
Types ¶
type Badger ¶
type Badger struct {
// contains filtered or unexported fields
}
func NewBadger ¶
func NewBadger(conf BadgerConfig) (*Badger, error)
func (*Badger) AlbumsToBeDeleted ¶
func (*Badger) CountImages ¶
func (*Badger) CountImagesCompressed ¶
func (*Badger) GetImageSrc ¶
func (*Badger) GetImagesIds ¶
func (*Badger) GetImagesOrdered ¶
func (*Badger) UpdateCompressionStatus ¶
type BadgerConfig ¶
type BadgerConfig struct { InMemory bool `mapstructure:"DATABASE_BADGER_IN_MEMORY"` GcRatio float64 `mapstructure:"DATABASE_BADGER_GC_RATIO" validate:"required"` CleanupInterval time.Duration `mapstructure:"DATABASE_BADGER_CLEANUP_INTERVAL" validate:"required"` LRU int `mapstructure:"DATABASE_BADGER_LRU" validate:"required"` Compressed bool }
type DatabaseConfig ¶
type DatabaseConfig struct { Database string `mapstructure:"APP_DATABASE" validate:"required"` Mem MemConfig `mapstructure:",squash"` Mongo MongoConfig `mapstructure:",squash"` Badger BadgerConfig `mapstructure:",squash"` }
type Mem ¶
type Mem struct {
// contains filtered or unexported fields
}
func (*Mem) AlbumsToBeDeleted ¶
func (*Mem) CountImagesCompressed ¶
func (*Mem) GetImageSrc ¶
func (*Mem) GetImagesIds ¶
func (*Mem) GetImagesOrdered ¶
func (*Mem) UpdateCompressionStatus ¶
type Mongo ¶
type Mongo struct {
// contains filtered or unexported fields
}
func (*Mongo) AlbumsToBeDeleted ¶
func (*Mongo) CountImages ¶
func (*Mongo) CountImagesCompressed ¶
func (*Mongo) GetImageSrc ¶
func (*Mongo) GetImagesIds ¶
func (*Mongo) GetImagesOrdered ¶
func (*Mongo) UpdateCompressionStatus ¶
type MongoConfig ¶
type MongoConfig struct { Host string `mapstructure:"DATABASE_MONGO_HOST" validate:"required"` Port string `mapstructure:"DATABASE_MONGO_PORT" validate:"required"` RetryTimes int `mapstructure:"DATABASE_MONGO_RETRY_TIMES" validate:"required"` RetryPause time.Duration `mapstructure:"DATABASE_MONGO_RETRY_PAUSE" validate:"required"` Timeout time.Duration `mapstructure:"DATABASE_MONGO_TIMEOUT" validate:"required"` LRU int `mapstructure:"DATABASE_MONGO_LRU" validate:"required"` Compressed bool }
Click to show internal directories.
Click to hide internal directories.