configstore

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package configstore provides gateway key and tenant hierarchy storage backends.

Index

Constants

This section is empty.

Variables

View Source
var ErrConflict = errors.New("config store record conflicts with existing data")
View Source
var ErrNotFound = errors.New("config store record not found")
View Source
var ErrNotImplemented = errors.New("config store method not implemented")

Functions

This section is empty.

Types

type ConfigStore

type ConfigStore interface {
	GatewayKeyStore
	GatewayKeyUsageTracker
	OrgStore

	// GetGatewayKey resolves an active gateway key by token hash.
	GetGatewayKey(ctx context.Context, keyHash string) (*GatewayKey, error)
}

ConfigStore is the gateway configuration boundary that backs key resolution, gateway key management, and tenant hierarchy lookups.

type GatewayKey

type GatewayKey struct {
	ID          string
	Token       string
	TokenHash   string
	OrgID       string
	WorkspaceID string
	Team        string
	Name        string
	Description string
	CreatedBy   string
	LastUsedAt  time.Time
	Role        string
	Permissions []string
	CreatedAt   time.Time
	RevokedAt   time.Time
}

type GatewayKeyFilter

type GatewayKeyFilter struct {
	OrgID       string
	WorkspaceID string
}

type GatewayKeyStore

type GatewayKeyStore interface {
	ListGatewayKeys(ctx context.Context, filter GatewayKeyFilter) ([]GatewayKey, error)
	CreateGatewayKey(ctx context.Context, key GatewayKey) (*GatewayKey, error)
	RevokeGatewayKey(ctx context.Context, id string, filter GatewayKeyFilter) error
	RotateGatewayKey(ctx context.Context, id, token string, filter GatewayKeyFilter) (*GatewayKey, error)
	Close() error
}

type GatewayKeyUsageTracker

type GatewayKeyUsageTracker interface {
	TouchGatewayKeyLastUsed(ctx context.Context, id string, filter GatewayKeyFilter) error
}

type OrgStore

type OrgStore interface {
	GetOrganization(ctx context.Context, id string) (*Organization, error)
	GetWorkspace(ctx context.Context, id string) (*Workspace, error)
	ListWorkspaces(ctx context.Context, orgID string) ([]Workspace, error)
}

OrgStore resolves the organization -> workspace hierarchy used by gateway keys.

type Organization

type Organization struct {
	ID        string
	Name      string
	CreatedAt time.Time
}

Organization is the top-level tenant boundary for gateway data.

type PostgresStore

type PostgresStore struct {
	DSN string
	// contains filtered or unexported fields
}

func NewPostgresStore

func NewPostgresStore(dsn string) (*PostgresStore, error)

func (*PostgresStore) Close

func (s *PostgresStore) Close() error

func (*PostgresStore) CreateGatewayKey

func (s *PostgresStore) CreateGatewayKey(ctx context.Context, key GatewayKey) (*GatewayKey, error)

func (*PostgresStore) GetGatewayKey

func (s *PostgresStore) GetGatewayKey(ctx context.Context, keyHash string) (*GatewayKey, error)

func (*PostgresStore) GetOrganization

func (s *PostgresStore) GetOrganization(ctx context.Context, id string) (*Organization, error)

func (*PostgresStore) GetWorkspace

func (s *PostgresStore) GetWorkspace(ctx context.Context, id string) (*Workspace, error)

func (*PostgresStore) ListGatewayKeys

func (s *PostgresStore) ListGatewayKeys(ctx context.Context, filter GatewayKeyFilter) ([]GatewayKey, error)

func (*PostgresStore) ListWorkspaces

func (s *PostgresStore) ListWorkspaces(ctx context.Context, orgID string) ([]Workspace, error)

func (*PostgresStore) RevokeGatewayKey

func (s *PostgresStore) RevokeGatewayKey(ctx context.Context, id string, filter GatewayKeyFilter) error

func (*PostgresStore) RotateGatewayKey

func (s *PostgresStore) RotateGatewayKey(ctx context.Context, id, token string, filter GatewayKeyFilter) (*GatewayKey, error)

func (*PostgresStore) TouchGatewayKeyLastUsed

func (s *PostgresStore) TouchGatewayKeyLastUsed(ctx context.Context, id string, filter GatewayKeyFilter) error

type StaticStore

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

func NewStaticStore

func NewStaticStore(keys []GatewayKey) *StaticStore

func (*StaticStore) Close

func (s *StaticStore) Close() error

func (*StaticStore) CreateGatewayKey

func (s *StaticStore) CreateGatewayKey(_ context.Context, _ GatewayKey) (*GatewayKey, error)

func (*StaticStore) GetGatewayKey

func (s *StaticStore) GetGatewayKey(_ context.Context, keyHash string) (*GatewayKey, error)

func (*StaticStore) GetOrganization

func (s *StaticStore) GetOrganization(_ context.Context, id string) (*Organization, error)

func (*StaticStore) GetWorkspace

func (s *StaticStore) GetWorkspace(_ context.Context, id string) (*Workspace, error)

func (*StaticStore) ListGatewayKeys

func (s *StaticStore) ListGatewayKeys(_ context.Context, filter GatewayKeyFilter) ([]GatewayKey, error)

func (*StaticStore) ListWorkspaces

func (s *StaticStore) ListWorkspaces(_ context.Context, orgID string) ([]Workspace, error)

func (*StaticStore) RevokeGatewayKey

func (s *StaticStore) RevokeGatewayKey(_ context.Context, _ string, _ GatewayKeyFilter) error

func (*StaticStore) RotateGatewayKey

func (s *StaticStore) RotateGatewayKey(_ context.Context, _ string, _ string, _ GatewayKeyFilter) (*GatewayKey, error)

func (*StaticStore) TouchGatewayKeyLastUsed

func (s *StaticStore) TouchGatewayKeyLastUsed(_ context.Context, _ string, _ GatewayKeyFilter) error

type Workspace

type Workspace struct {
	ID        string
	OrgID     string
	Name      string
	CreatedAt time.Time
}

Workspace is a collaboration boundary within an organization.

Jump to

Keyboard shortcuts

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