Documentation ¶
Index ¶
- Constants
- Variables
- type FingerMismatchError
- type Generation
- type Key
- type KeyPiece
- type KeyStateMachine
- func (ksm *KeyStateMachine) GetCurrentGeneration() int64
- func (ksm *KeyStateMachine) GetInProgressGenertion() int64
- func (ksm *KeyStateMachine) GetNodes(generation int64) ([]string, error)
- func (ksm *KeyStateMachine) NeedsReplication(uuid string, generationNumber int64) bool
- func (ksm *KeyStateMachine) NewGeneration(newNode string) (generationNumber int64, peers []string, err error)
- func (ksm KeyStateMachine) NodeInGeneration(generationNumber int64, nodeId string) bool
- func (ksm *KeyStateMachine) OwnerComplete(ownerId string, generation int64) error
- func (ksm *KeyStateMachine) Serialise(writer io.Writer) error
- func (ksm *KeyStateMachine) SerialiseToPFSDir() error
- func (ksm *KeyStateMachine) Update(req *pb.KeyStateCommand) error
- func (ksm *KeyStateMachine) UpdateFromStateFile(filePath string) error
Constants ¶
View Source
const KSM_FILE_NAME string = "key_state"
View Source
const PrimeSize int = 320 // 40 bytes
Variables ¶
View Source
var ErrGenerationDeprecated = errors.New("given generation was created before the current generation was set")
View Source
var Log *logger.ParanoidLogger
Functions ¶
This section is empty.
Types ¶
type FingerMismatchError ¶
func (*FingerMismatchError) Error ¶
func (e *FingerMismatchError) Error() string
type Generation ¶
type Generation struct { //A list of all nodes included in the generation Nodes []string CompleteNodes []string Elements []*keyStateElement }
func (*Generation) AddCompleteNode ¶
func (g *Generation) AddCompleteNode(ownerId string)
func (*Generation) AddElement ¶
func (g *Generation) AddElement(elem *keyStateElement)
func (*Generation) RemoveCompleteNode ¶
func (g *Generation) RemoveCompleteNode()
func (*Generation) RemoveElement ¶
func (g *Generation) RemoveElement()
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
func GenerateKey ¶
func RebuildKey ¶
Rebuild a Key from a set of KeyPieces. This function will succeed iff len(pieces) >= requiredPieces from the Generate function.
func (Key) GetFingerprint ¶
type KeyPiece ¶
type KeyStateMachine ¶
type KeyStateMachine struct { CurrentGeneration int64 InProgressGeneration int64 DeprecatedGeneration int64 // The first index indicates the generation. // The second index is unimportant as order doesn't matter there. Generations map[int64]*Generation // This is, once again, to avoid an import cycle PfsDir string // Channel is pushed to every time a new generation is created. Events chan bool // contains filtered or unexported fields }
var StateMachine *KeyStateMachine
func NewKSM ¶
func NewKSM(pfsDir string) *KeyStateMachine
func NewKSMFromPFSDir ¶
func NewKSMFromPFSDir(pfsDir string) (*KeyStateMachine, error)
func NewKSMFromReader ¶
func NewKSMFromReader(reader io.Reader) (*KeyStateMachine, error)
func (*KeyStateMachine) GetCurrentGeneration ¶
func (ksm *KeyStateMachine) GetCurrentGeneration() int64
func (*KeyStateMachine) GetInProgressGenertion ¶
func (ksm *KeyStateMachine) GetInProgressGenertion() int64
func (*KeyStateMachine) GetNodes ¶
func (ksm *KeyStateMachine) GetNodes(generation int64) ([]string, error)
func (*KeyStateMachine) NeedsReplication ¶
func (ksm *KeyStateMachine) NeedsReplication(uuid string, generationNumber int64) bool
func (*KeyStateMachine) NewGeneration ¶
func (ksm *KeyStateMachine) NewGeneration(newNode string) (generationNumber int64, peers []string, err error)
func (KeyStateMachine) NodeInGeneration ¶
func (ksm KeyStateMachine) NodeInGeneration(generationNumber int64, nodeId string) bool
func (*KeyStateMachine) OwnerComplete ¶
func (ksm *KeyStateMachine) OwnerComplete(ownerId string, generation int64) error
func (*KeyStateMachine) SerialiseToPFSDir ¶
func (ksm *KeyStateMachine) SerialiseToPFSDir() error
func (*KeyStateMachine) Update ¶
func (ksm *KeyStateMachine) Update(req *pb.KeyStateCommand) error
func (*KeyStateMachine) UpdateFromStateFile ¶
func (ksm *KeyStateMachine) UpdateFromStateFile(filePath string) error
Click to show internal directories.
Click to hide internal directories.