store

package
v0.0.43 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: MIT Imports: 28 Imported by: 8

Documentation

Index

Constants

View Source
const (
	MaxStreamLength = 50
)
View Source
const (
	NotificationExpiryDuration = time.Minute
)

Variables

This section is empty.

Functions

func NewPostgres added in v0.0.36

func NewPostgres(config PostgresConfig) data.Store

func NewRedis

func NewRedis(config RedisConfig) data.Store

func NewWeb added in v0.0.9

func NewWeb(config WebConfig) data.Store

Types

type Postgres added in v0.0.36

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

func (*Postgres) Connect added in v0.0.36

func (s *Postgres) Connect(ctx context.Context)

func (*Postgres) CreateEntity added in v0.0.36

func (s *Postgres) CreateEntity(ctx context.Context, entityType, parentId, name string)

func (*Postgres) CreateSnapshot added in v0.0.36

func (s *Postgres) CreateSnapshot(ctx context.Context) data.Snapshot

func (*Postgres) DeleteEntity added in v0.0.36

func (s *Postgres) DeleteEntity(ctx context.Context, entityId string)

Fix DeleteEntity to clean up notifications

func (*Postgres) Disconnect added in v0.0.36

func (s *Postgres) Disconnect(ctx context.Context)

func (*Postgres) EntityExists added in v0.0.36

func (s *Postgres) EntityExists(ctx context.Context, entityId string) bool

func (*Postgres) FieldExists added in v0.0.36

func (s *Postgres) FieldExists(ctx context.Context, fieldName, entityType string) bool

func (*Postgres) FindEntities added in v0.0.36

func (s *Postgres) FindEntities(ctx context.Context, entityType string) []string

func (*Postgres) GetEntity added in v0.0.36

func (s *Postgres) GetEntity(ctx context.Context, entityId string) data.Entity

func (*Postgres) GetEntitySchema added in v0.0.36

func (s *Postgres) GetEntitySchema(ctx context.Context, entityType string) data.EntitySchema

func (*Postgres) GetEntityTypes added in v0.0.36

func (s *Postgres) GetEntityTypes(ctx context.Context) []string

func (*Postgres) GetFieldSchema added in v0.0.36

func (s *Postgres) GetFieldSchema(ctx context.Context, entityType, fieldName string) data.FieldSchema

func (*Postgres) IsConnected added in v0.0.36

func (s *Postgres) IsConnected(ctx context.Context) bool

func (*Postgres) Notify added in v0.0.36

func (*Postgres) ProcessNotifications added in v0.0.36

func (s *Postgres) ProcessNotifications(ctx context.Context)

Fix notification processing to avoid lock copying

func (*Postgres) Read added in v0.0.36

func (s *Postgres) Read(ctx context.Context, requests ...data.Request)

func (*Postgres) RestoreSnapshot added in v0.0.36

func (s *Postgres) RestoreSnapshot(ctx context.Context, ss data.Snapshot)

func (*Postgres) SetEntity added in v0.0.36

func (s *Postgres) SetEntity(ctx context.Context, e data.Entity)

func (*Postgres) SetEntitySchema added in v0.0.36

func (s *Postgres) SetEntitySchema(ctx context.Context, schema data.EntitySchema)

func (*Postgres) SetFieldSchema added in v0.0.36

func (s *Postgres) SetFieldSchema(ctx context.Context, entityType, fieldName string, schema data.FieldSchema)

func (*Postgres) Unnotify added in v0.0.36

func (s *Postgres) Unnotify(ctx context.Context, token string)

func (*Postgres) UnnotifyCallback added in v0.0.36

func (s *Postgres) UnnotifyCallback(ctx context.Context, token string, callback data.NotificationCallback)

func (*Postgres) Write added in v0.0.36

func (s *Postgres) Write(ctx context.Context, requests ...data.Request)

type PostgresConfig added in v0.0.36

type PostgresConfig struct {
	ConnectionString string
}

type Redis

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

func (*Redis) Connect

func (s *Redis) Connect(ctx context.Context)

func (*Redis) CreateEntity

func (s *Redis) CreateEntity(ctx context.Context, entityType, parentId, name string)

func (*Redis) CreateSnapshot

func (s *Redis) CreateSnapshot(ctx context.Context) data.Snapshot

func (*Redis) DeleteEntity

func (s *Redis) DeleteEntity(ctx context.Context, entityId string)

func (*Redis) Disconnect

func (s *Redis) Disconnect(ctx context.Context)

func (*Redis) EntityExists

func (s *Redis) EntityExists(ctx context.Context, entityId string) bool

func (*Redis) FieldExists

func (s *Redis) FieldExists(ctx context.Context, fieldName, entityType string) bool

func (*Redis) FindEntities

func (s *Redis) FindEntities(ctx context.Context, entityType string) []string

func (*Redis) GetEntity

func (s *Redis) GetEntity(ctx context.Context, entityId string) data.Entity

func (*Redis) GetEntitySchema

func (s *Redis) GetEntitySchema(ctx context.Context, entityType string) data.EntitySchema

func (*Redis) GetEntityTypes

func (s *Redis) GetEntityTypes(ctx context.Context) []string

func (*Redis) GetFieldSchema

func (s *Redis) GetFieldSchema(ctx context.Context, entityType, fieldName string) data.FieldSchema

func (*Redis) IsConnected

func (s *Redis) IsConnected(ctx context.Context) bool

func (*Redis) ProcessNotifications

func (s *Redis) ProcessNotifications(ctx context.Context)

func (*Redis) Read

func (s *Redis) Read(ctx context.Context, requests ...data.Request)

func (*Redis) ResolveIndirection

func (s *Redis) ResolveIndirection(ctx context.Context, indirectField, entityId string) (string, string)

func (*Redis) RestoreSnapshot

func (s *Redis) RestoreSnapshot(ctx context.Context, ss data.Snapshot)

func (*Redis) SetEntity

func (s *Redis) SetEntity(ctx context.Context, e data.Entity)

func (*Redis) SetEntitySchema

func (s *Redis) SetEntitySchema(ctx context.Context, newSchema data.EntitySchema)

func (*Redis) SetFieldSchema

func (s *Redis) SetFieldSchema(ctx context.Context, entityType, fieldName string, value data.FieldSchema)

func (*Redis) Unnotify

func (s *Redis) Unnotify(ctx context.Context, e string)

func (*Redis) UnnotifyCallback

func (s *Redis) UnnotifyCallback(ctx context.Context, e string, c data.NotificationCallback)

func (*Redis) Write

func (s *Redis) Write(ctx context.Context, requests ...data.Request)

type RedisConfig

type RedisConfig struct {
	Address  string
	Password string
}

type RedisKeyGenerator

type RedisKeyGenerator struct{}

schema:entity:<type> -> DatabaseEntitySchema schema:field:<name> -> DatabaseFieldSchema instance:entity:<entityId> -> DatabaseEntity instance:field:<name>:<entityId> -> DatabaseField instance:type:<entityType> -> []string{entityId...} instance:notification-config:<entityId>:<fieldName> -> []string{subscriptionId...} instance:notification-config:<entityType>:<fieldName> -> []string{subscriptionId...}

func (*RedisKeyGenerator) GetEntityIdNotificationConfigKey

func (g *RedisKeyGenerator) GetEntityIdNotificationConfigKey(entityId, fieldName string) string

func (*RedisKeyGenerator) GetEntityKey

func (g *RedisKeyGenerator) GetEntityKey(entityId string) string

func (*RedisKeyGenerator) GetEntitySchemaKey

func (g *RedisKeyGenerator) GetEntitySchemaKey(entityType string) string

func (*RedisKeyGenerator) GetEntityTypeKey

func (g *RedisKeyGenerator) GetEntityTypeKey(entityType string) string

func (*RedisKeyGenerator) GetEntityTypeNotificationConfigKey

func (g *RedisKeyGenerator) GetEntityTypeNotificationConfigKey(entityType, fieldName string) string

func (*RedisKeyGenerator) GetFieldKey

func (g *RedisKeyGenerator) GetFieldKey(fieldName, entityId string) string

func (*RedisKeyGenerator) GetNotificationChannelKey

func (g *RedisKeyGenerator) GetNotificationChannelKey(serviceId string) string

type Web added in v0.0.9

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

func (*Web) Connect added in v0.0.9

func (s *Web) Connect(ctx context.Context)

func (*Web) CreateEntity added in v0.0.9

func (s *Web) CreateEntity(ctx context.Context, entityType, parentId, name string)

func (*Web) CreateSnapshot added in v0.0.9

func (s *Web) CreateSnapshot(ctx context.Context) data.Snapshot

func (*Web) DeleteEntity added in v0.0.9

func (s *Web) DeleteEntity(ctx context.Context, entityId string)

func (*Web) Disconnect added in v0.0.9

func (s *Web) Disconnect(ctx context.Context)

func (*Web) EntityExists added in v0.0.9

func (s *Web) EntityExists(ctx context.Context, entityId string) bool

func (*Web) FieldExists added in v0.0.9

func (s *Web) FieldExists(ctx context.Context, fieldName, entityType string) bool

func (*Web) FindEntities added in v0.0.9

func (s *Web) FindEntities(ctx context.Context, entityType string) []string

func (*Web) GetEntity added in v0.0.9

func (s *Web) GetEntity(ctx context.Context, entityId string) data.Entity

func (*Web) GetEntitySchema added in v0.0.9

func (s *Web) GetEntitySchema(ctx context.Context, entityType string) data.EntitySchema

func (*Web) GetEntityTypes added in v0.0.9

func (s *Web) GetEntityTypes(ctx context.Context) []string

func (*Web) IsConnected added in v0.0.9

func (s *Web) IsConnected(ctx context.Context) bool

func (*Web) Notify added in v0.0.9

func (*Web) ProcessNotifications added in v0.0.9

func (s *Web) ProcessNotifications(ctx context.Context)

func (*Web) Read added in v0.0.9

func (s *Web) Read(ctx context.Context, requests ...data.Request)

func (*Web) RestoreSnapshot added in v0.0.9

func (s *Web) RestoreSnapshot(ctx context.Context, ss data.Snapshot)

func (*Web) SetEntity added in v0.0.9

func (s *Web) SetEntity(ctx context.Context, e data.Entity)

func (*Web) SetEntitySchema added in v0.0.9

func (s *Web) SetEntitySchema(ctx context.Context, schema data.EntitySchema)

func (*Web) Unnotify added in v0.0.9

func (s *Web) Unnotify(ctx context.Context, token string)

func (*Web) UnnotifyCallback added in v0.0.9

func (s *Web) UnnotifyCallback(ctx context.Context, token string, cb data.NotificationCallback)

func (*Web) Write added in v0.0.9

func (s *Web) Write(ctx context.Context, requests ...data.Request)

type WebConfig added in v0.0.9

type WebConfig struct {
	Address string
}

Jump to

Keyboard shortcuts

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