store

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2015 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigEntry

func GetConfigEntry(node_type string) (interface{}, error)

func GetSession added in v1.1.0

func GetSession(collection string) (*mgo.Session, *mgo.Collection, error)

func MakeNodeID

func MakeNodeID(length int) string

func RemoveNodeEntry

func RemoveNodeEntry(node_type, id string) error

func SetConfig added in v1.1.0

func SetConfig(c *config.Server)

func SetConfigEntry

func SetConfigEntry(node_type string, config interface{}) error

func UpdateNodeEntry

func UpdateNodeEntry(node_type, id string, request NodeCreateRequest) error

func UpdateNodeEntryLastSeen

func UpdateNodeEntryLastSeen(node_type, id string) error

Types

type ConfigEntry

type ConfigEntry struct {
	NodeType      string      `json:"node_type" bson:"_id"`
	LastUpdated   time.Time   `json:"lastUpdated" bson:"lastUpdated"`
	Configuration interface{} `json:"config" bson:"config"`
}

func (ConfigEntry) FromMap

func (c ConfigEntry) FromMap(m bson.M) ConfigEntry

func (ConfigEntry) ToMap

func (c ConfigEntry) ToMap() bson.M

type NodeCreateRequest

type NodeCreateRequest struct {
	Hostname string `json:"hostname"`
	Port     int    `json:"port"`
}

type NodeEntry

type NodeEntry struct {
	ID       string    `json:"id" bson:"_id"`
	NodeType string    `json:"node_type" bson:"node_type"`
	Hostname string    `json:"hostname" bson:"hostname"`
	Port     int       `json:"port" bson:"port"`
	LastSeen time.Time `json:"lastSeen" bson:"lastSeen"`
}

func CreateNodeEntry

func CreateNodeEntry(node_type string, request NodeCreateRequest) (NodeEntry, error)

func GetNodeEntries

func GetNodeEntries(node_type string) ([]NodeEntry, error)

func GetNodeEntry

func GetNodeEntry(node_type, id string) (NodeEntry, error)

func (NodeEntry) FromMap

func (c NodeEntry) FromMap(m bson.M) NodeEntry

func (NodeEntry) ToMap

func (c NodeEntry) ToMap() bson.M

type ValidationError

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

func (ValidationError) Error

func (e ValidationError) Error() string

Jump to

Keyboard shortcuts

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