storage

package
v0.0.0-...-b56449a Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2015 License: MPL-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressedMessage

type AddressedMessage struct {
	Message
	Recipient string
	Sender    string
}

AddressedMessage is a Message with a Sender and Recipient public key.

type ContactInfo

type ContactInfo struct {
	Name    string
	Address *sf.PublicKey
}

ContactInfo represents the local name for an address.

type ContactInfos

type ContactInfos []ContactInfo

ContactInfos is a sortable slice of contact information.

func (ContactInfos) Len

func (c ContactInfos) Len() int

Len implements sort.Interface.

func (ContactInfos) Less

func (c ContactInfos) Less(i, j int) bool

Less implements sort.Interface.

func (ContactInfos) Swap

func (c ContactInfos) Swap(i, j int)

Swap implements sort.Interface.

type Contacts

type Contacts interface {

	// Key returns the latest public key for the given name.
	Key(name string) (*sf.PublicKey, error)

	// Name returns the latest name given to the public key.
	Name(key *sf.PublicKey) (string, error)

	// Put assigns a public key to a given name, superseding any prior name
	// assignment.
	Put(name string, key *sf.PublicKey) error

	// Current returns the current name assignments.
	Current() (ContactInfos, error)
}

Contacts organizes public keys by a locally assigned name.

type Message

type Message struct {
	ID       string
	Contents []byte
}

Message is some content with a unique identifier.

type Service

type Service interface {

	// Push queues a message to a recipient.
	Push(msg *AddressedMessage) error

	// Pop retrieves messages addressed to a recipient and removes them.
	Pop(recipient string) ([]*AddressedMessage, error)
}

Service stores messages for a shadowfax server.

type Vault

type Vault interface {

	// Current returns the latest key pair.
	Current() (*sf.KeyPair, error)

	// Get returns the key pair for the given public key.
	Get(key *sf.PublicKey) (*sf.KeyPair, error)

	// Put adds a new key pair, which becomes the latest, current key pair.
	Put(keyPair *sf.KeyPair) error

	// Each calls the given function with each key pair in the vault.
	//
	// Iteration stops if the function returns an error.
	Each(func(key *sf.KeyPair) error) error
}

Vault stores public-private key pairs.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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