Documentation ¶
Index ¶
- Constants
- func GetClock() uint64
- func IncrementClock(base uint64) uint64
- func KeyToID(key Identifier) uint64
- type ContextKey
- type Finger
- type FingerTable
- type Identifier
- type Interval
- type Node
- type SuccessorRequest
- type TransactionEntity
- type TransactionEntry
- type TransactionLog
- type TransactionOperation
Constants ¶
const M = 20 * 8
M - This is the max number of nodes in a finger table
Variables ¶
This section is empty.
Functions ¶
func IncrementClock ¶
func KeyToID ¶
func KeyToID(key Identifier) uint64
KeyToID - helper to convert a key to a chord ring id
Types ¶
type ContextKey ¶
type ContextKey uint64
ContextKey - this is a type which is used as keys for the context
const ( // DataPathContextKey - this is the context key for the data path DataPathContextKey ContextKey = iota // NumRequestWorkerContextKey - this is the context key for the data path NumRequestWorkerContextKey // SignatureContextKey - this is how the signature of the request is passed // to the handlers SignatureContextKey // ValidOwnerFunctionContextKey - function that performs validation of the ownership of a file ValidOwnerFunctionContextKey // RequestFileOwnerIDContextKey - The request "from" field RequestFileOwnerIDContextKey SelfPrivateKeyContextKey SelfIDContextKey SelfNodeContextKey UserPublicKeyContextKey ResourceNameContextKey )
type FingerTable ¶
type FingerTable struct {
// contains filtered or unexported fields
}
FingerTable - This is the structure of a finger table
func NewFingerTable ¶
func NewFingerTable() *FingerTable
NewFingerTable - Provision a new finger table
func (*FingerTable) GetIth ¶
func (ft *FingerTable) GetIth(i uint64) (Finger, error)
GetIth - Get the i'th entry from the given finger table, and return that finger.
func (*FingerTable) SetIth ¶
func (ft *FingerTable) SetIth(i uint64, interval Interval, successor, self Node) error
SetIth - Set the i'th entry in a given finger table
func (*FingerTable) ToString ¶
func (ft *FingerTable) ToString() string
ToString - string representation of a finger table
type Identifier ¶
type Identifier [20]byte
Identifier - This is a common Chord Identifier, also used for file names
type Interval ¶
Interval - This is the interval in which a successor in the finger table is responsible
func NewInterval ¶
NewInterval - helper to create a new interval based on two nodes
type Node ¶
type Node struct { ID Identifier Addr string PublicKey *rsa.PublicKey }
Node - This is a peer node representation
func (Node) Compare ¶
Compare - Given a Node, compare the parameter nPrime with this node to see which is greater/less/equal
func (Node) CompareID ¶
func (n Node) CompareID(id Identifier) int
CompareID - Given a Node, compare it's ID to the id parameter
type SuccessorRequest ¶
type SuccessorRequest struct {
ID Identifier
}
SuccessorRequest - this is the chord successor request strurture, the ID is the key we are looking to find a successor for.
type TransactionEntity ¶
type TransactionEntity struct { ResourceName string ResourceID Identifier Entries []TransactionEntry }
TransactionEntity - a record of a transaction
type TransactionEntry ¶
type TransactionEntry struct { Operation TransactionOperation ClientID Identifier Timestamp uint64 }
type TransactionLog ¶
type TransactionLog map[string]TransactionEntity
TransactionLog - a list of TransactionEntities
type TransactionOperation ¶
type TransactionOperation int
const ( UpdateOperation TransactionOperation = iota DeleteOperation )