mystorage

package
v0.4.6-0...-8bcbb2a Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Addr      string `json:"addr.omitempty"`
	Token     string `json:"token,omitempty"`
	KeyPrefix string `json:"key_prefix,omitempty"`
}

Config is the configuration for consul storage

type Storage

type Storage struct {
	Client *api.Client

	KV     *api.KV
	Config *Config
	// contains filtered or unexported fields
}

Storage implements the certmagic storage's interface This holds the consul client and kv store

func (Storage) CaddyModule

func (Storage) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information

func (*Storage) CertMagicStorage

func (s *Storage) CertMagicStorage() (certmagic.Storage, error)

CertMagicStorage transforms storage to certmagic.Storage

func (*Storage) Cleanup

func (s *Storage) Cleanup() error

Cleanup releases the holding resources

func (*Storage) Delete

func (s *Storage) Delete(key string) error

Delete deletes key. An error should be returned only if the key still exists when the method returns.

func (*Storage) Exists

func (s *Storage) Exists(key string) bool

Exists returns true if the key exists and there was no error checking.

func (*Storage) List

func (s *Storage) List(prefix string, recursive bool) ([]string, error)

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) Load

func (s *Storage) Load(key string) ([]byte, error)

Load retrieves the value at key.

func (*Storage) Lock

func (s *Storage) Lock(ctx context.Context, key string) error

Lock locks key

func (*Storage) Provision

func (s *Storage) Provision(ctx caddy.Context) error

Provision initializes the storage

func (*Storage) Stat

func (s *Storage) Stat(key string) (certmagic.KeyInfo, error)

Stat returns information about key.

func (*Storage) Store

func (s *Storage) Store(key string, value []byte) error

Store stores the key into consul's kv store

func (*Storage) Unlock

func (s *Storage) Unlock(key string) error

Unlock unlocks key

func (*Storage) UnmarshalCaddyfile

func (s *Storage) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile deserialize Caddyfile tokens into consul storage's config

storage consul {
   addr
   token
   key_prefix
}

func (*Storage) Validate

func (s *Storage) Validate() error

Validate checks the resource is set up correctly

Jump to

Keyboard shortcuts

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