subscription

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SubscriptionExistsErrorName is the name given to an error where the subscription
	// already exists in the store.
	SubscriptionExistsErrorName = "SubscriptionExists"
	// SubscriptionNotFoundErrorName is the name given to an error where the subscription
	// is not found in the store.
	SubscriptionNotFoundErrorName = "SubscriptionNotFound"
)

Variables

View Source
var (
	ErrSubscriptionExists   = errors.New(SubscriptionExistsErrorName, "subscription already exists")
	ErrSubscriptionNotFound = errors.New(SubscriptionNotFoundErrorName, "subscription not found")
)

Functions

This section is empty.

Types

type ListByProviderAndCustomerConfig

type ListByProviderAndCustomerConfig = store.PaginationConfig

type ListByProviderAndCustomerOption

type ListByProviderAndCustomerOption func(cfg *ListByProviderAndCustomerConfig)

func WithListByProviderAndCustomerCursor

func WithListByProviderAndCustomerCursor(cursor string) ListByProviderAndCustomerOption

func WithListByProviderAndCustomerLimit

func WithListByProviderAndCustomerLimit(limit int) ListByProviderAndCustomerOption

type Record

type Record struct {
	// DID of the provider who services this subscription
	Provider did.DID
	// ID of this subscription - should be unique per-provider
	Subscription string
	// DID of the customer who maintains this subscription
	Customer did.DID
	// CID of the invocation that created this subscription
	Cause cid.Cid
	// Timestamp of when this subscription was created
	InsertedAt time.Time
}

type Store

type Store interface {
	// Get a subscription by provider DID and subscription ID. May return
	// [ErrSubscriptionNotFound].
	Get(ctx context.Context, provider did.DID, subscription string) (Record, error)
	// Add a subscription - a relationship between a customer and a provider that
	// will allow for provisioning of consumers. May return [ErrSubscriptionExists]
	// if the subscription already exists.
	Add(ctx context.Context, provider did.DID, subscription string, customer did.DID, cause cid.Cid) error
	// A list of the subscriptions a customer has with a provider.
	ListByProviderAndCustomer(ctx context.Context, provider did.DID, customer did.DID, options ...ListByProviderAndCustomerOption) (store.Page[Record], error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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