persist

package
v0.0.0-...-3ed0934 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Datastore

type Datastore struct {
	// The Google Cloud project hosting the datastore
	ProjectID string

	// Cloud Datastore entity Kind
	Kind string
	// contains filtered or unexported fields
}

Datastore uses Google Cloud Datastore to persist dns records

func (*Datastore) Close

func (d *Datastore) Close() error

Close always returns nil

func (*Datastore) Delete

func (d *Datastore) Delete(key string) error

Delete deletes a key from the domain map

func (*Datastore) Dump

func (d *Datastore) Dump() ([]byte, error)

Dump is not implemented

func (*Datastore) Get

func (d *Datastore) Get(key string) (string, error)

Get returns a value from the domain map

func (*Datastore) Init

func (d *Datastore) Init() error

Init configures the cloud datastore client

func (*Datastore) Set

func (d *Datastore) Set(r record.Record) error

Set adds a key value pair to the domain map

type Memory

type Memory struct {
	// contains filtered or unexported fields
}

Memory is a Memory type that satisfies the Persist interface

func (*Memory) Close

func (m *Memory) Close() error

Close always returns nil

func (*Memory) Delete

func (m *Memory) Delete(key string) error

Delete deletes a key from the domain map

func (*Memory) Dump

func (m *Memory) Dump() ([]byte, error)

Dump returns all entires json encoded

func (*Memory) Get

func (m *Memory) Get(key string) (string, error)

Get returns a value from the domain map

func (*Memory) Init

func (m *Memory) Init() error

Init creates the initial domain map

func (*Memory) Set

func (m *Memory) Set(r record.Record) error

Set adds a key value pair to the domain map

type Persist

type Persist interface {
	// Initialize the namespace
	Init() error

	// Get a key's value
	Get(key string) (string, error)

	// Set a key's value
	Set(r record.Record) error

	// Delete a key
	Delete(key string) error

	// Close the connection
	Close() error

	// Dump all entries
	Dump() ([]byte, error)
}

Persist provides persistent storage

Jump to

Keyboard shortcuts

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