Documentation
¶
Index ¶
- func InitializeSqliteDatabase(ctx context.Context, sqliteCfg config.SqliteConfig, ...) (eventstore.EventsSaver, eventstore.EventsRetriever, eventstore.LockProvider, ...)
- type BoundaryPools
- type SqliteAdminDB
- func (a *SqliteAdminDB) CreateBoundaryIndex(ctx context.Context, boundary, name string, ...) error
- func (a *SqliteAdminDB) DeleteUser(id string) error
- func (a *SqliteAdminDB) DropBoundaryIndex(ctx context.Context, boundary, name string) error
- func (a *SqliteAdminDB) GetEventsCount(boundary string) (int, error)
- func (a *SqliteAdminDB) GetProjectorLastPosition(projectorName string) (*eventstore.Position, error)
- func (a *SqliteAdminDB) GetUserById(id string) (eventstore.User, error)
- func (a *SqliteAdminDB) GetUserByUsername(username string) (eventstore.User, error)
- func (a *SqliteAdminDB) GetUsersCount() (uint32, error)
- func (a *SqliteAdminDB) ListAdminUsers() ([]*eventstore.User, error)
- func (a *SqliteAdminDB) SaveEventCount(count int, boundary string) error
- func (a *SqliteAdminDB) SaveUsersCount(count uint32) error
- func (a *SqliteAdminDB) UpdateProjectorPosition(name string, position *eventstore.Position) error
- func (a *SqliteAdminDB) UpsertUser(user eventstore.User) error
- type SqliteEventPublishing
- type SqliteGetEvents
- type SqliteSaveEvents
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitializeSqliteDatabase ¶ added in v0.2.7
func InitializeSqliteDatabase( ctx context.Context, sqliteCfg config.SqliteConfig, adminCfg config.AdminConfig, boundaries []string, js jetstream.JetStream, logger logging.Logger, ) (eventstore.EventsSaver, eventstore.EventsRetriever, eventstore.LockProvider, common.DB, eventstore.EventPublishingTracker, error)
InitializeSqliteDatabase opens per-boundary SQLite pools and constructs the five backend interfaces. Boundary identity is the file: {dir}/{boundary}.db.
Types ¶
type BoundaryPools ¶ added in v0.2.7
BoundaryPools holds the write and read connection pools backing one boundary's SQLite file.
Write pool is sized to 1: SQLite serializes writers anyway via its file lock, so a single in-flight writer queues callers in Go and avoids SQLITE_BUSY churn. Read pool is sized to runtime.NumCPU() — under WAL, readers run concurrently with the single writer.
func OpenBoundaryPools ¶ added in v0.2.7
func OpenBoundaryPools(ctx context.Context, dir, boundary, adminBoundary string) (*BoundaryPools, error)
OpenBoundaryPools opens write+read pools for one boundary at {dir}/{boundary}.db. Migrations are applied on the first connection drawn from the write pool. adminBoundary controls whether admin-only tables (users, users_count) are created.
func (*BoundaryPools) Close ¶ added in v0.2.7
func (b *BoundaryPools) Close() error
type SqliteAdminDB ¶ added in v0.2.7
type SqliteAdminDB struct {
// contains filtered or unexported fields
}
func NewSqliteAdminDB ¶ added in v0.2.7
func NewSqliteAdminDB(pools map[string]*BoundaryPools, adminBoundary string, logger logging.Logger) *SqliteAdminDB
func (*SqliteAdminDB) CreateBoundaryIndex ¶ added in v0.2.7
func (a *SqliteAdminDB) CreateBoundaryIndex( ctx context.Context, boundary, name string, fields []eventstore.BoundaryIndexField, conditions []eventstore.BoundaryIndexCondition, combinator string, ) error
CreateBoundaryIndex builds a partial expression index over orisun_es_event.data JSON keys. Index name = "{name}_idx" inside the boundary's database.
func (*SqliteAdminDB) DeleteUser ¶ added in v0.2.7
func (a *SqliteAdminDB) DeleteUser(id string) error
func (*SqliteAdminDB) DropBoundaryIndex ¶ added in v0.2.7
func (a *SqliteAdminDB) DropBoundaryIndex(ctx context.Context, boundary, name string) error
func (*SqliteAdminDB) GetEventsCount ¶ added in v0.2.7
func (a *SqliteAdminDB) GetEventsCount(boundary string) (int, error)
func (*SqliteAdminDB) GetProjectorLastPosition ¶ added in v0.2.7
func (a *SqliteAdminDB) GetProjectorLastPosition(projectorName string) (*eventstore.Position, error)
func (*SqliteAdminDB) GetUserById ¶ added in v0.2.7
func (a *SqliteAdminDB) GetUserById(id string) (eventstore.User, error)
func (*SqliteAdminDB) GetUserByUsername ¶ added in v0.2.7
func (a *SqliteAdminDB) GetUserByUsername(username string) (eventstore.User, error)
func (*SqliteAdminDB) GetUsersCount ¶ added in v0.2.7
func (a *SqliteAdminDB) GetUsersCount() (uint32, error)
func (*SqliteAdminDB) ListAdminUsers ¶ added in v0.2.7
func (a *SqliteAdminDB) ListAdminUsers() ([]*eventstore.User, error)
func (*SqliteAdminDB) SaveEventCount ¶ added in v0.2.7
func (a *SqliteAdminDB) SaveEventCount(count int, boundary string) error
func (*SqliteAdminDB) SaveUsersCount ¶ added in v0.2.7
func (a *SqliteAdminDB) SaveUsersCount(count uint32) error
func (*SqliteAdminDB) UpdateProjectorPosition ¶ added in v0.2.7
func (a *SqliteAdminDB) UpdateProjectorPosition(name string, position *eventstore.Position) error
func (*SqliteAdminDB) UpsertUser ¶ added in v0.2.7
func (a *SqliteAdminDB) UpsertUser(user eventstore.User) error
type SqliteEventPublishing ¶ added in v0.2.7
type SqliteEventPublishing struct {
// contains filtered or unexported fields
}
func NewSqliteEventPublishing ¶ added in v0.2.7
func NewSqliteEventPublishing(pools map[string]*BoundaryPools, logger logging.Logger) *SqliteEventPublishing
func (*SqliteEventPublishing) GetLastPublishedEventPosition ¶ added in v0.2.7
func (p *SqliteEventPublishing) GetLastPublishedEventPosition(ctx context.Context, boundary string) (eventstore.Position, error)
func (*SqliteEventPublishing) InsertLastPublishedEvent ¶ added in v0.2.7
type SqliteGetEvents ¶ added in v0.2.7
type SqliteGetEvents struct {
// contains filtered or unexported fields
}
func NewSqliteGetEvents ¶ added in v0.2.7
func NewSqliteGetEvents(pools map[string]*BoundaryPools, logger logging.Logger) *SqliteGetEvents
func (*SqliteGetEvents) Get ¶ added in v0.2.7
func (s *SqliteGetEvents) Get(ctx context.Context, req *eventstore.GetEventsRequest) (*eventstore.GetEventsResponse, error)
type SqliteSaveEvents ¶ added in v0.2.7
type SqliteSaveEvents struct {
// contains filtered or unexported fields
}
func NewSqliteSaveEvents ¶ added in v0.2.7
func NewSqliteSaveEvents(pools map[string]*BoundaryPools, logger logging.Logger) *SqliteSaveEvents
func (*SqliteSaveEvents) Save ¶ added in v0.2.7
func (s *SqliteSaveEvents) Save( ctx context.Context, events []eventstore.EventWithMapTags, boundary string, expectedPosition *eventstore.Position, streamConsistencyCondition *eventstore.Query, ) (transactionID string, globalID int64, err error)