Documentation ¶
Index ¶
- type Item
- type Storage
- func (Storage) CaddyModule() caddy.ModuleInfo
- func (s *Storage) CertMagicStorage() (certmagic.Storage, error)
- func (s *Storage) Delete(_ context.Context, key string) error
- func (s *Storage) Exists(ctx context.Context, key string) bool
- func (s *Storage) List(_ context.Context, prefix string, recursive bool) ([]string, error)
- func (s *Storage) Load(_ context.Context, key string) ([]byte, error)
- func (s *Storage) Lock(ctx context.Context, key string) error
- func (s *Storage) Stat(_ context.Context, key string) (certmagic.KeyInfo, error)
- func (s *Storage) Store(_ context.Context, key string, value []byte) error
- func (s *Storage) Unlock(ctx context.Context, key string) error
- func (s *Storage) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Item ¶
type Item struct { PrimaryKey string `json:"PrimaryKey"` Contents string `json:"Contents"` LastUpdated time.Time `json:"LastUpdated"` }
Item holds structure of domain, certificate data, and last updated for marshaling with DynamoDb
type Storage ¶
type Storage struct { // Table - [required] DynamoDB table name Table string `json:"table,omitempty"` AwsSession *session.Session `json:"-"` // AwsEndpoint - [optional] provide an override for DynamoDB service. // By default it'll use the standard production DynamoDB endpoints. // Useful for testing with a local DynamoDB instance. AwsEndpoint string `json:"aws_endpoint,omitempty"` // AwsRegion - [optional] region using DynamoDB in. // Useful for testing with a local DynamoDB instance. AwsRegion string `json:"aws_region,omitempty"` // AwsDisableSSL - [optional] disable SSL for DynamoDB connections. Default: false // Only useful for local testing, do not use outside of local testing. AwsDisableSSL bool `json:"aws_disable_ssl,omitempty"` // LockTimeout - [optional] how long to wait for a lock to be created. Default: 5 minutes LockTimeout caddy.Duration `json:"lock_timeout,omitempty"` // LockPollingInterval - [optional] how often to check for lock released. Default: 5 seconds LockPollingInterval caddy.Duration `json:"lock_polling_interval,omitempty"` }
Storage implements certmagic.Storage to facilitate storage of certificates in DynamoDB for a clustered environment. Also implements certmagic.Locker to facilitate locking and unlocking of cert data during storage
func (Storage) CaddyModule ¶
func (Storage) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*Storage) CertMagicStorage ¶
CertMagicStorage converts s to a certmagic.Storage instance.
func (*Storage) List ¶
List returns all keys that match prefix. If recursive is true, non-terminal keys will be enumerated (i.e. "directories" should be walked); otherwise, only keys prefixed exactly by prefix will be listed.
func (*Storage) Lock ¶
Lock acquires the lock for key, blocking until the lock can be obtained or an error is returned. Note that, even after acquiring a lock, an idempotent operation may have already been performed by another process that acquired the lock before - so always check to make sure idempotent operations still need to be performed after acquiring the lock.
The actual implementation of obtaining of a lock must be an atomic operation so that multiple Lock calls at the same time always results in only one caller receiving the lock at any given time.
To prevent deadlocks, all implementations (where this concern is relevant) should put a reasonable expiration on the lock in case Unlock is unable to be called due to some sort of network failure or system crash.