Documentation ¶
Index ¶
- Constants
- Variables
- func DeleteNick(id string)
- func Lookup(q string) string
- func Nicks() map[string]string
- func WatchCSV() error
- type Entity
- func (e *Entity) ConnectPeer() (pi p2peer.AddrInfo, err error)
- func (e *Entity) FetchAndSetDocument() error
- func (e *Entity) FetchDocument(cached bool) (*doc.Document, error)
- func (e *Entity) HandleIncomingMessages(ctx context.Context, msgChan chan *Message)
- func (e Entity) Nick() string
- func (e Entity) SetNick(nick string) error
- func (e *Entity) Verify() error
- type Message
Constants ¶
const (
MESSAGES_BUFFERSIZE = 100
)
Variables ¶
Functions ¶
func DeleteNick ¶ added in v0.4.0
func DeleteNick(id string)
Types ¶
type Entity ¶
type Entity struct { // Live non-stored data // Context to be able to clean up entity. Ctx context.Context Cancel context.CancelFunc Topic *p2ppubsub.Topic //Stored data DID did.DID Doc *doc.Document // Channels Messages chan *Message }
func Fetch ¶ added in v0.4.0
Creates a ned Entity from a DID and fetched the live document. This is used mostly for foreign entities.
func GetOrCreate ¶
GetOrCreate checks if an Entity with the given DID string exists and returns it; otherwise, it creates a new Entity, stores it, and returns it. The boolean signifies whether to use a cached Entity document in IPFS, or to perform a network search. This might take time at the scale of minutes.
func New ¶
Creates a new Entity from a DID, but does not fetch the document. Use this when creating a new actor for instance
func (*Entity) ConnectPeer ¶ added in v0.3.0
This function connects to a peer using the DHT. The peer is identified by it's DID. The return value is the peer's AddrInfo. But you needn't use that for anything
func (*Entity) FetchAndSetDocument ¶ added in v0.0.11
Fetch the document and set it in the entity. If cached is true, the document will be fetched from the IPFS cache, if available.
func (*Entity) FetchDocument ¶ added in v0.0.11
func (*Entity) HandleIncomingMessages ¶ added in v0.3.0
Handle incoming messages to an entity. The message are recieved in the e|ntity's message channel. And delivered to a channel of your choice.
func (Entity) Nick ¶ added in v0.0.6
Returns the Entity's nick. Uses and sets the DID as fallback. This does not actually save the nick, as it it will always return the same value for the same DID.
type Message ¶ added in v0.4.0
func NewMessage ¶ added in v0.4.0
Wraps a message and a boolean indicating if it was enveloped. Enveloped messages should probably be sent directly to the sender, whereas non-enveloped messages should be sent to the entity it was received from.