storage

package
v0.0.0-...-b517edd Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	Owner           string    `json:"owner"`
	Name            string    `json:"name"`
	PublicKey       string    `json:"publicKey"`
	Endpoint        string    `json:"endpoint"`
	Address         string    `json:"address"`
	DNS             string    `json:"dns"`
	CreatedAt       time.Time `json:"createdAt"`
	ServerPublicKey string    `json:"serverPublicKey"`
}

type DiskStorage

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

implements Storage interface

func NewDiskStorage

func NewDiskStorage(directory string) *DiskStorage

func (*DiskStorage) Delete

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

func (*DiskStorage) Get

func (s *DiskStorage) Get(key string) (*Device, error)

func (*DiskStorage) List

func (s *DiskStorage) List(prefix string) ([]*Device, error)

func (*DiskStorage) Save

func (s *DiskStorage) Save(key string, device *Device) error

type InMemoryStorage

type InMemoryStorage struct{}

implements Storage interface

func NewMemoryStorage

func NewMemoryStorage() *InMemoryStorage

func (*InMemoryStorage) Delete

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

func (*InMemoryStorage) Get

func (s *InMemoryStorage) Get(key string) (*Device, error)

func (*InMemoryStorage) List

func (s *InMemoryStorage) List(prefix string) ([]*Device, error)

func (*InMemoryStorage) Save

func (s *InMemoryStorage) Save(key string, device *Device) error

type Storage

type Storage interface {
	Save(key string, device *Device) error
	List(prefix string) ([]*Device, error)
	Get(key string) (*Device, error)
	Delete(key string) error
}

Jump to

Keyboard shortcuts

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