driver

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package driver defines the TenantStore interface and associated types.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTenantNotFound                  = errors.New("tenant does not exist")
	ErrTenantDeleted                   = errors.New("tenant has been deleted")
	ErrDuplicateDestination            = errors.New("destination already exists")
	ErrDestinationNotFound             = errors.New("destination does not exist")
	ErrDestinationDeleted              = errors.New("destination has been deleted")
	ErrDestinationConflict             = errors.New("destination was modified concurrently")
	ErrMaxDestinationsPerTenantReached = errors.New("maximum number of destinations per tenant reached")
	ErrListTenantNotSupported          = errors.New("list tenant feature is not enabled")
	ErrInvalidCursor                   = cursor.ErrInvalidCursor
	ErrInvalidOrder                    = errors.New("invalid order: must be 'asc' or 'desc'")
	ErrConflictingCursors              = errors.New("cannot specify both next and prev cursors")
)

Functions

This section is empty.

Types

type ListDestinationRequest added in v0.15.0

type ListDestinationRequest struct {
	TenantID        string   // required — destinations are always tenant-scoped
	IDs             []string // optional — filter to these destination IDs only
	Type            []string // optional — OR semantics (matches any)
	Topics          []string // optional — AND semantics ("*" = wildcard-only)
	AllowWildcards  bool     // whether persisted wildcard patterns participate in topic matching
	ExcludeInternal bool     // skip destinations of internal types
}

ListDestinationRequest contains parameters for listing destinations.

type ListTenantRequest

type ListTenantRequest struct {
	Limit int      // Number of results per page (default: 20)
	Next  string   // Cursor for next page
	Prev  string   // Cursor for previous page
	Dir   string   // Sort direction: "asc" or "desc" (default: "desc")
	ID    []string // If non-empty, only tenants with these IDs are returned
}

ListTenantRequest contains parameters for listing tenants.

type SeekPagination

type SeekPagination struct {
	OrderBy string  `json:"order_by"`
	Dir     string  `json:"dir"`
	Limit   int     `json:"limit"`
	Next    *string `json:"next"`
	Prev    *string `json:"prev"`
}

SeekPagination represents cursor-based pagination metadata for list responses.

type TenantPaginatedResult

type TenantPaginatedResult struct {
	Models     []models.Tenant `json:"models"`
	Pagination SeekPagination  `json:"pagination"`
	Count      int             `json:"count"`
}

TenantPaginatedResult contains the paginated list of tenants.

type TenantStore

type TenantStore interface {
	Init(ctx context.Context) error
	RetrieveTenant(ctx context.Context, tenantID string) (*models.Tenant, error)
	UpsertTenant(ctx context.Context, tenant models.Tenant) error
	DeleteTenant(ctx context.Context, tenantID string) error
	ListTenant(ctx context.Context, req ListTenantRequest) (*TenantPaginatedResult, error)
	ListDestination(ctx context.Context, req ListDestinationRequest) ([]models.Destination, error)
	RetrieveDestination(ctx context.Context, tenantID, destinationID string) (*models.Destination, error)
	CreateDestination(ctx context.Context, destination models.Destination) error
	// UpsertDestination writes unconditionally, skipping the tenant, duplicate,
	// limit and version checks. It is for seeding and tests.
	UpsertDestination(ctx context.Context, destination models.Destination) error
	// UpdateDestination writes a destination retrieved earlier, only if it still
	// exists and is unchanged since that read. It returns ErrDestinationNotFound
	// when the destination is gone or deleted and ErrDestinationConflict when it
	// was written meanwhile.
	UpdateDestination(ctx context.Context, destination models.Destination) error
	DeleteDestination(ctx context.Context, tenantID, destinationID string) error
	MatchEvent(ctx context.Context, event models.Event, allowWildcards bool) ([]string, error)
}

TenantStore is the interface for tenant and destination storage.

Jump to

Keyboard shortcuts

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