Documentation
¶
Overview ¶
Package local is the resource provider a `celerity dev` session runs under.
It is selected by importing it, which `celerity-go generate --local` writes for a development session and never for a deployment:
import _ "github.com/newstack-cloud/celerity-go-sdk/resources/local" import _ "github.com/newstack-cloud/celerity-go-sdk/resources/local/redis"
What it serves and what it delegates ¶
A queue and a topic, and nothing else. The other four kinds are handed to whichever platform provider is also linked, so a session reaches the emulators that provider was pointed at.
Most of what a session runs speaks the protocol the real service speaks: MinIO answers S3 requests and DynamoDB Local answers DynamoDB's, so a bucket and a data store are reached through the platform's own provider with its endpoint pointed elsewhere. SQS and SNS have no such stand-in, so those two are served locally instead.
Where the serving happens ¶
Not here. This package decides which kinds a session serves and resolves the rest; what carries a local queue or topic is a backend package, linked alongside and registering itself. Today that is resources/local/redis, which this package knows nothing about.
Index ¶
- Constants
- type Provider
- func (p *Provider) Bucket(ref resources.Ref) (bucket.Store, error)
- func (p *Provider) Cache(ref resources.Ref) (cache.Client, error)
- func (p *Provider) Close(ctx context.Context) error
- func (p *Provider) Datastore(ref resources.Ref) (datastore.Client, error)
- func (p *Provider) Detect() bool
- func (p *Provider) Name() string
- func (p *Provider) Queue(ref resources.Ref) (queue.Client, error)
- func (p *Provider) SQLDatabase(ref resources.Ref) (sqldb.Client, error)
- func (p *Provider) Topic(ref resources.Ref) (topic.Client, error)
Constants ¶
const Name = "local"
Name identifies this provider in errors and in the handler manifest.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider serves the resource kinds a development session has to serve itself, and delegates every other kind to the platform's provider.
func New ¶
func New() *Provider
New returns the local resource provider.
An application does not construct one: importing this package registers it. Exported for a test that drives the provider directly.
func (*Provider) Bucket ¶
Bucket hands a bucket to the platform's provider, which a session reaches through the endpoint it was pointed at.
func (*Provider) Cache ¶
Cache hands a cache to the platform's provider. A cache is the same code on every platform, including the Valkey a session runs, so there is nothing to redirect.
func (*Provider) Close ¶
Close gives back what the linked backends hold, which for a queue and a topic over Redis is the connection they share.
The platform provider's own release is not called from here: both are registered, so the application releases each of them.
func (*Provider) Datastore ¶
Datastore hands a data store to the platform's provider, which a session reaches through the endpoint it was pointed at.
func (*Provider) Detect ¶
Detect reports whether this process is a development session.
The CLI says so explicitly rather than this being inferred: a session's deploy target is still the platform the application will be deployed to, so the platform's own provider is linked alongside. Exactly one of the two detects at a time, whichever order the generated file imports them in.
func (*Provider) SQLDatabase ¶
SQLDatabase hands a database to the platform's provider, which a session points at whatever it runs.