actor

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2024 License: GPL-3.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const ENVELOPES_BUFFERSIZE = 100
View Source
const PUBSUB_MESSAGES_BUFFERSIZE = 32

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor struct {
	Entity *entity.Entity

	Keyset set.Keyset

	// Envelopes are here. Messages comes to the entity.
	// So Entity.Messages
	Envelopes chan *msg.Envelope
}

An actor is just an entity with a keyset.

func GetOrCreate

func GetOrCreate(id string) (*Actor, error)

// Get an entity from the global map. // The input is a full did string. If one is created it will have no Nick. // The function should do the required lookups to get the nick. // And verify the entity.

func Init added in v0.4.0

func Init() *Actor

Initialise an actor or panic. This is a common sugar function to create an actor from the keyset and set the DID Document. Meant to be called from most main's. Panics if the actor is not valid.

func New

func New(k set.Keyset) (*Actor, error)

Create a new entity from a DID and a Keyset. We need both. The DID is to verify the entity, and the keyset is to create the DID Document.

func NewFromPackedKeyset

func NewFromPackedKeyset(data string, cached bool) (*Actor, error)

func (*Actor) HandleIncomingEnvelopes added in v0.3.0

func (a *Actor) HandleIncomingEnvelopes(ctx context.Context, messages chan *entity.Message)

Lets actor listen for incoming envelopes and open them, if possible. The actor can decrypt the messages, which are then sent to the intended recipient. This is a little extra step., but it makes the design simpler and easier to understand /methinks. Sent the messages to the message channel in the input. Then you can handle the messages in the UI or wherever you want to handle them and you know they were private messages.

func (*Actor) HelloWorld added in v0.4.0

func (a *Actor) HelloWorld(ctx context.Context)

func (*Actor) IsValid

func (a *Actor) IsValid() bool

func (*Actor) Subscribe

func (a *Actor) Subscribe(ctx context.Context, e *entity.Entity)

Subscribe to the entity's topic and handle incoming messages. the actor is the entity that will receive the messages. It may well be the entity itself. Takes a channel for message delivery.

func (*Actor) Verify

func (a *Actor) Verify() error

type ActorConfig added in v0.4.0

type ActorConfig struct {
	Actor config.ActorConfig `yaml:"actor"`
	API   config.APIConfig   `yaml:"api"`
	DB    config.DBConfig    `yaml:"db"`
	HTTP  config.HTTPConfig  `yaml:"http"`
	Log   config.LogConfig   `yaml:"log"`
	P2P   config.P2PConfig   `yaml:"p2p"`
}

func Config added in v0.4.0

func Config() ActorConfig

This is an all-inclusive configuration function that sets up the configuration for the actor. flags and everything. It is used in the main function of simple actors programmes. It also parses the common flags.

func (*ActorConfig) MarshalToYAML added in v0.4.0

func (c *ActorConfig) MarshalToYAML() ([]byte, error)

func (*ActorConfig) Print added in v0.4.0

func (c *ActorConfig) Print()

func (*ActorConfig) Save added in v0.4.0

func (c *ActorConfig) Save() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL