Documentation ¶
Overview ¶
Package badgerstorage implements certmagic.Storage on top of a Badger database.
It's an alternative to the default file-system storage used by CertMagic.
Example ¶
// setup the badger DB db, err := badger.Open(badger.DefaultOptions("").WithInMemory(true)) if err != nil { log.Fatalf("Cannot open badger memory DB: %s", err) } // set the default CertMagic storage to replace the file-system based on. certmagic.Default.Storage = New(db) // setup the rest of your CertMagic stuff...
Output:
Index ¶
- type Storage
- func (sto *Storage) Delete(_ context.Context, key string) error
- func (sto *Storage) Exists(_ context.Context, key string) bool
- func (sto *Storage) List(_ context.Context, prefix string, recursive bool) ([]string, error)
- func (sto *Storage) Load(_ context.Context, key string) ([]byte, error)
- func (sto *Storage) Lock(_ context.Context, key string) error
- func (sto *Storage) Stat(_ context.Context, key string) (certmagic.KeyInfo, error)
- func (sto *Storage) Store(_ context.Context, key string, value []byte) error
- func (sto *Storage) Unlock(_ context.Context, key string) error
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Storage ¶
type Storage struct { // DB is the underlying badger database DB *badger.DB // contains filtered or unexported fields }
Storage implements certmagic.Storage
func New ¶
func New(db *badger.DB) *Storage
New return a new Storage using db to store persisted data.
Click to show internal directories.
Click to hide internal directories.