Documentation ¶
Index ¶
- type Item
- type Storage
- func (Storage) CaddyModule() caddy.ModuleInfo
- func (s *Storage) CertMagicStorage() (certmagic.Storage, error)
- func (s *Storage) Delete(key string) error
- func (s *Storage) Exists(key string) bool
- func (s *Storage) List(prefix string, recursive bool) ([]string, error)
- func (s *Storage) Load(key string) ([]byte, error)
- func (s *Storage) Lock(ctx context.Context, key string) error
- func (s *Storage) Stat(key string) (certmagic.KeyInfo, error)
- func (s *Storage) Store(key string, value []byte) error
- func (s *Storage) Unlock(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 string `json:"table,omitempty"` AwsSession *session.Session `json:"-"` AwsEndpoint string `json:"aws_endpoint,omitempty"` AwsRegion string `json:"aws_region,omitempty"` AwsDisableSSL bool `json:"aws_disable_ssl,omitempty"` LockTimeout caddy.Duration `json:"lock_timeout,omitempty"` 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.