Documentation ¶
Index ¶
- Constants
- type Algolio
- type AlgolioImpl
- func (a *AlgolioImpl) Communicate(peer interface{}) error
- func (a *AlgolioImpl) CommunicateWithPeer(peer Peer) error
- func (a *AlgolioImpl) Con(ctx context.Context) net.Conn
- func (a *AlgolioImpl) ContributeToCommunityMemory(t transaction.Transaction) error
- func (a *AlgolioImpl) DiscoverPeers(targetAddr string)
- func (a *AlgolioImpl) GetID() string
- func (a *AlgolioImpl) GetMetadata() map[string]string
- func (a *AlgolioImpl) GetPeers() map[string]string
- func (a *AlgolioImpl) Id() string
- func (a *AlgolioImpl) LearnFromInteraction(interaction Interaction)
- func (a *AlgolioImpl) Log(level, message string)
- func (a *AlgolioImpl) Metadata() map[string]string
- func (a *AlgolioImpl) ProcessInteraction(interaction Interaction)
- func (a *AlgolioImpl) ProcessTransaction(t transaction.Transaction) error
- func (a *AlgolioImpl) ShareKnowledge(t transaction.Transaction) error
- func (a *AlgolioImpl) StartServer()
- type Graph
- type Interaction
- type MockAlgolio
- func (m *MockAlgolio) Communicate(peer algolio.Algolio) error
- func (m *MockAlgolio) CommunicateWithPeer(peer Peer) error
- func (m *MockAlgolio) ContributeToCommunityMemory(t transaction.Transaction) error
- func (m *MockAlgolio) DiscoverPeers() ([]Peer, error)
- func (m *MockAlgolio) GetID() string
- func (m *MockAlgolio) GetMetadata() map[string]string
- func (m *MockAlgolio) LearnFromInteraction(interaction Interaction)
- func (m *MockAlgolio) ProcessInteraction(interaction Interaction)
- func (m *MockAlgolio) ProcessTransaction(t transaction.Transaction) error
- func (m *MockAlgolio) ShareKnowledge(t transaction.Transaction) error
- type MockInteraction
- type Node
- type Peer
- type SpecificInteraction
Constants ¶
const ( KnowledgeSharing = "KnowledgeSharing" TransactionProcessing = "TransactionProcessing" PeerDiscovery = "PeerDiscovery" )
Define specific interaction types as constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Algolio ¶
type Algolio interface { ProcessTransaction(transaction.Transaction) error DiscoverPeers(targetAddr string) ContributeToCommunityMemory(transaction.Transaction) error ProcessInteraction(interaction Interaction) LearnFromInteraction(interaction Interaction) Id() string Metadata() map[string]string Con(context.Context) net.Conn Log(level, message string) GetPeers() map[string]string StartServer() Peer }
func NewAlgolio ¶
type AlgolioImpl ¶
type AlgolioImpl struct { ID string InternalID int Conn net.Conn Peers map[string]string Addr string DKGInstance *ped.DistKeyGenerator Deals map[int]*ped.Deal Responses map[int][]*ped.Response PrivateKey kyber.Scalar PublicKey kyber.Point }
func (*AlgolioImpl) Communicate ¶
func (a *AlgolioImpl) Communicate(peer interface{}) error
func (*AlgolioImpl) CommunicateWithPeer ¶
func (a *AlgolioImpl) CommunicateWithPeer(peer Peer) error
func (*AlgolioImpl) ContributeToCommunityMemory ¶
func (a *AlgolioImpl) ContributeToCommunityMemory(t transaction.Transaction) error
func (*AlgolioImpl) DiscoverPeers ¶
func (a *AlgolioImpl) DiscoverPeers(targetAddr string)
func (*AlgolioImpl) GetID ¶
func (a *AlgolioImpl) GetID() string
func (*AlgolioImpl) GetMetadata ¶
func (a *AlgolioImpl) GetMetadata() map[string]string
func (*AlgolioImpl) GetPeers ¶
func (a *AlgolioImpl) GetPeers() map[string]string
func (*AlgolioImpl) Id ¶
func (a *AlgolioImpl) Id() string
func (*AlgolioImpl) LearnFromInteraction ¶
func (a *AlgolioImpl) LearnFromInteraction(interaction Interaction)
func (*AlgolioImpl) Log ¶
func (a *AlgolioImpl) Log(level, message string)
func (*AlgolioImpl) Metadata ¶
func (a *AlgolioImpl) Metadata() map[string]string
func (*AlgolioImpl) ProcessInteraction ¶
func (a *AlgolioImpl) ProcessInteraction(interaction Interaction)
func (*AlgolioImpl) ProcessTransaction ¶
func (a *AlgolioImpl) ProcessTransaction(t transaction.Transaction) error
func (*AlgolioImpl) ShareKnowledge ¶
func (a *AlgolioImpl) ShareKnowledge(t transaction.Transaction) error
func (*AlgolioImpl) StartServer ¶
func (a *AlgolioImpl) StartServer()
type Interaction ¶
type Interaction interface { GetType() string // Returns the type of interaction (e.g., "KnowledgeSharing", "TransactionProcessing") GetDetails() map[string]string // Returns details about the interaction }
Interaction defines the interface for interactions between Algolios.
type MockAlgolio ¶
type MockAlgolio struct { ID string Peers []algolio.Algolio PeerInfo []Peer DiscoveryCriteria map[string]string Metadata map[string]string }
MockAlgolio is a mock implementation of the Algolio interface.
func (*MockAlgolio) Communicate ¶
func (m *MockAlgolio) Communicate(peer algolio.Algolio) error
func (*MockAlgolio) CommunicateWithPeer ¶
func (m *MockAlgolio) CommunicateWithPeer(peer Peer) error
CommunicateWithPeer Updated CommunicateWithPeer method to initiate specific interactions
func (*MockAlgolio) ContributeToCommunityMemory ¶
func (m *MockAlgolio) ContributeToCommunityMemory(t transaction.Transaction) error
func (*MockAlgolio) DiscoverPeers ¶
func (m *MockAlgolio) DiscoverPeers() ([]Peer, error)
DiscoverPeers Enhanced DiscoverPeers method with dynamic criteria
func (*MockAlgolio) GetID ¶
func (m *MockAlgolio) GetID() string
GetID Ensure MockAlgolio implements the Peer interface
func (*MockAlgolio) GetMetadata ¶
func (m *MockAlgolio) GetMetadata() map[string]string
func (*MockAlgolio) LearnFromInteraction ¶
func (m *MockAlgolio) LearnFromInteraction(interaction Interaction)
Simple learning mechanism to adjust Algolio's peer discovery strategy
func (*MockAlgolio) ProcessInteraction ¶
func (m *MockAlgolio) ProcessInteraction(interaction Interaction)
ProcessInteraction Implement interaction logic in Algolio's behaviors
func (*MockAlgolio) ProcessTransaction ¶
func (m *MockAlgolio) ProcessTransaction(t transaction.Transaction) error
func (*MockAlgolio) ShareKnowledge ¶
func (m *MockAlgolio) ShareKnowledge(t transaction.Transaction) error
type MockInteraction ¶
type MockInteraction struct{}
func (MockInteraction) GetDetails ¶
func (mi MockInteraction) GetDetails() map[string]string
func (MockInteraction) GetType ¶
func (mi MockInteraction) GetType() string
type SpecificInteraction ¶
SpecificInteraction represents a concrete implementation of the Interaction interface, tailored to our defined interaction types.
func NewSpecificInteraction ¶
func NewSpecificInteraction(interactionType string, details map[string]string) SpecificInteraction
NewSpecificInteraction creates a new instance of a specific interaction.
func (SpecificInteraction) GetDetails ¶
func (si SpecificInteraction) GetDetails() map[string]string
func (SpecificInteraction) GetType ¶
func (si SpecificInteraction) GetType() string