Documentation ¶
Index ¶
- Constants
- func BuildKeyMap(contacts ContactList) map[string][]string
- func Compare(a *NodeID, b *NodeID) int
- func Hash(value string) []byte
- func HashByte(value []byte) []byte
- func HexNodeID(id NodeID) string
- func KeyValue(key string, value string) map[string]string
- func MakeByteArray(str string) []byte
- func MakeByteSlice(id NodeID) []byte
- func MakeGUID() []byte
- func MakeHex(barray []byte) string
- func Pretty(v interface{}) string
- func RespondNotFound() string
- func RespondNotOk() string
- func RespondOk() string
- func RespondWithData(data interface{}) string
- func RespondWithStatus(status string, data interface{}) string
- func VerifyKV(key string, value string) bool
- type BlockServer
- func (bs *BlockServer) Contact() Contact
- func (bs *BlockServer) FindNode(c *web.Context, node string) string
- func (bs *BlockServer) FindValue(c *web.Context, key string) string
- func (bs *BlockServer) IterativeFindNode(c *web.Context, node string) string
- func (bs *BlockServer) IterativeFindValue(c *web.Context, key string) (value string)
- func (bs *BlockServer) IterativeStore(c *web.Context) string
- func (bs *BlockServer) Store(c *web.Context) string
- func (bs *BlockServer) UpdateContact(contact Contact)
- type Bucket
- type Contact
- func DecodeModataHeaders(header http.Header) (Contact, error)
- func JsonGet(uri string, self Contact) (string, interface{}, Contact)
- func JsonPost(uri string, data map[string]string, self Contact) (string, interface{}, Contact)
- func JsonPostUrl(uri string, self Contact) (string, interface{}, Contact)
- func MakeContact(v interface{}) Contact
- type ContactDistance
- type ContactDistanceList
- type ContactList
- type Key
- type KeyInfo
- type NodeID
- type ReplicationServer
- type RoutingTable
Constants ¶
View Source
const ( OK = "OK" NOTFOUND = "NOTFOUND" NOTOK = "NOTOK" ERROR = "ERROR" )
Response codes
View Source
const Alpha = 3
View Source
const IDLength = 20
Bytes are 8 bits, so a size 20 byte array means a 160 bit nodeid
View Source
const REPL_INTERVAL = 10 * time.Second
Variables ¶
This section is empty.
Functions ¶
func BuildKeyMap ¶
func BuildKeyMap(contacts ContactList) map[string][]string
func MakeByteArray ¶
func MakeByteSlice ¶
func RespondNotFound ¶
func RespondNotFound() string
func RespondNotOk ¶
func RespondNotOk() string
func RespondWithData ¶
func RespondWithData(data interface{}) string
func RespondWithStatus ¶
REST convenience to marshall all the things to json
Types ¶
type BlockServer ¶
type BlockServer struct {
// contains filtered or unexported fields
}
func StartBlockServer ¶
func StartBlockServer(name string) *BlockServer
func (*BlockServer) Contact ¶
func (bs *BlockServer) Contact() Contact
func (*BlockServer) FindNode ¶
func (bs *BlockServer) FindNode(c *web.Context, node string) string
Locally find a node
func (*BlockServer) FindValue ¶
func (bs *BlockServer) FindValue(c *web.Context, key string) string
Locally find a value
func (*BlockServer) IterativeFindNode ¶
func (bs *BlockServer) IterativeFindNode(c *web.Context, node string) string
Do a distributed find node
func (*BlockServer) IterativeFindValue ¶
func (bs *BlockServer) IterativeFindValue(c *web.Context, key string) (value string)
Do a distributed lookup, first does a distributed find node to find places it should query, then either it looks for values and stores any that are missing
func (*BlockServer) IterativeStore ¶
func (bs *BlockServer) IterativeStore(c *web.Context) string
Do a distributed store
func (*BlockServer) Store ¶
func (bs *BlockServer) Store(c *web.Context) string
Store a key,value pair locally
func (*BlockServer) UpdateContact ¶
func (bs *BlockServer) UpdateContact(contact Contact)
type Contact ¶
func MakeContact ¶
func MakeContact(v interface{}) Contact
func (*Contact) ToHttpAddress ¶
type ContactDistance ¶
func MakeContactDistance ¶
func MakeContactDistance(v interface{}) ContactDistance
type ContactDistanceList ¶
type ContactDistanceList []ContactDistance
func MakeContactDistanceList ¶
func MakeContactDistanceList(m []interface{}) ContactDistanceList
func (ContactDistanceList) Len ¶
func (l ContactDistanceList) Len() int
func (ContactDistanceList) Less ¶
func (l ContactDistanceList) Less(i, j int) bool
func (*ContactDistanceList) Peek ¶
func (l *ContactDistanceList) Peek() interface{}
func (*ContactDistanceList) Pop ¶
func (l *ContactDistanceList) Pop() interface{}
func (*ContactDistanceList) Push ¶
func (l *ContactDistanceList) Push(x interface{})
func (ContactDistanceList) Swap ¶
func (l ContactDistanceList) Swap(i, j int)
type ContactList ¶
type ContactList []Contact
func MakeContactList ¶
func MakeContactList(m []interface{}) ContactList
func (ContactList) Len ¶
func (l ContactList) Len() int
func (ContactList) Less ¶
func (l ContactList) Less(i, j int) bool
func (ContactList) Swap ¶
func (l ContactList) Swap(i, j int)
type KeyInfo ¶
type KeyInfo struct {
ClosestNodes ContactList
}
type ReplicationServer ¶
type ReplicationServer struct { MyContact Contact // contains filtered or unexported fields }
func StartReplicationServer ¶
func StartReplicationServer(name string, bs *BlockServer) *ReplicationServer
func (*ReplicationServer) IntelligentReplication ¶
func (rs *ReplicationServer) IntelligentReplication()
type RoutingTable ¶
type RoutingTable struct {
// contains filtered or unexported fields
}
func NewRoutingTable ¶
func NewRoutingTable(k int, id []byte) (rt *RoutingTable)
func (*RoutingTable) AllContacts ¶
func (rt *RoutingTable) AllContacts() ContactList
func (*RoutingTable) BucketForNode ¶
func (rt *RoutingTable) BucketForNode(n NodeID) (i int)
func (*RoutingTable) FindClosest ¶
func (rt *RoutingTable) FindClosest(k NodeID, alpha int) ContactDistanceList
func (*RoutingTable) Init ¶
func (rt *RoutingTable) Init()
func (*RoutingTable) Remove ¶
func (rt *RoutingTable) Remove(c Contact)
func (*RoutingTable) Update ¶
func (rt *RoutingTable) Update(c Contact)
Click to show internal directories.
Click to hide internal directories.