storage

package
v0.8.0-beta.10....-03d1928 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DBTYPE_NONE = iota
	DBTYPE_MEM
	DBTYPE_FS
	DBTYPE_GDBM
	DBTYPE_POSTGRES
)
View Source
const (
	STORETYPE_STATE = iota
	STORETYPE_RESOURCE
	STORETYPE_USER
)
View Source
const (
	DATATYPE_EXTEND = 128
)

Variables

View Source
var (
	DbModeDebug  = []string{"ANY", "BIN", "TXT"}
	DbTypeDebug  = []string{"NONE", "MEM", "FS", "GDBM", "POSTGRES"}
	DbStoreDebug = []string{"STATE", "RESOURCE", "USER"}
)

Functions

This section is empty.

Types

type ConnData

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

func ToConnData

func ToConnData(connStr string) (ConnData, error)

func ToConnDataMode

func ToConnDataMode(connStr string, mode DbMode) (ConnData, error)

func (*ConnData) DbType

func (cd *ConnData) DbType() int

func (*ConnData) Domain

func (cd *ConnData) Domain() string

func (*ConnData) Mode

func (cd *ConnData) Mode() DbMode

func (*ConnData) Path

func (cd *ConnData) Path() string

func (*ConnData) Raw

func (cd *ConnData) Raw() string

func (ConnData) String

func (cd ConnData) String() string

type Conns

type Conns map[int8]ConnData

func NewConns

func NewConns() Conns

func (Conns) Have

func (c Conns) Have(conn *ConnData) int8

func (Conns) Set

func (c Conns) Set(conn ConnData, typ int8)

type DbMode

type DbMode uint8
const (
	DBMODE_ANY DbMode = iota
	DBMODE_BINARY
	DBMODE_TEXT
)
type MenuStorageService struct {
	// contains filtered or unexported fields
}

func NewMenuStorageService

func NewMenuStorageService(conn Conns) *MenuStorageService
func (ms *MenuStorageService) Close(ctx context.Context) error

TODO: how to handle persister here?

func (ms *MenuStorageService) GetPersister(ctx context.Context) (*persist.Persister, error)
func (ms *MenuStorageService) GetResource(ctx context.Context) (resource.Resource, error)
func (ms *MenuStorageService) GetStateStore(ctx context.Context) (db.Db, error)
func (ms *MenuStorageService) GetUserdataDb(ctx context.Context) (db.Db, error)
func (ms *MenuStorageService) WithDb(store db.Db, typ int8) *MenuStorageService
func (ms *MenuStorageService) WithGettext(path string, lns []lang.Language) *MenuStorageService

WithGettext triggers use of gettext for translation of templates and menus.

The first language in `lns` will be used as default language, to resolve node keys to language strings.

If `lns` is an empty array, gettext will not be used.

type SimpleStorageProvider

type SimpleStorageProvider struct {
	*Storage
}

func (*SimpleStorageProvider) Close

func (*SimpleStorageProvider) Get

func (p *SimpleStorageProvider) Get(ctx context.Context, sessionId string) (*Storage, error)

func (*SimpleStorageProvider) Put

func (p *SimpleStorageProvider) Put(ctx context.Context, sessionId string, storage *Storage) error

type Storage

type Storage struct {
	Persister  *persist.Persister
	UserdataDb db.Db
}

func (*Storage) Close

func (s *Storage) Close(ctx context.Context) error

type StorageProvider

type StorageProvider interface {
	Get(ctx context.Context, sessionId string) (*Storage, error)
	Put(ctx context.Context, sessionId string, storage *Storage) error
	Close(ctx context.Context) error
}

func NewSimpleStorageProvider

func NewSimpleStorageProvider(stateStore db.Db, userdataStore db.Db) StorageProvider

type StorageService

type StorageService interface {
	GetPersister(ctx context.Context) (*persist.Persister, error)
	GetUserdataDb(ctx context.Context) (db.Db, error)
	GetResource(ctx context.Context) (resource.Resource, error)
}

Directories

Path Synopsis
db

Jump to

Keyboard shortcuts

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