agent

package module
v0.0.0-...-f0e711e Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

README

Package Agent

License

This exp/libp2p/agent package provides an experimental goabu.Agent implementation that is based on libp2p's pubsub package. The pubsub package is dual-licensed under the Apache 2.0 and MIT licenses.

Warning

This package is currently in an unreliable and experimental in-development phase. In the future, it may be modified arbitrarily or even disappear altogether.

Requirements

An adequate version of the Go language is required.

Installation

The package can be installed with the go get command:

$ go get github.com/max-co/goabu/communication/exp/libp2p/agent@libp2p-agent

License

The package is licensed under the Apache-2.0 License.

Documentation

Overview

Package agent provides an experimental and incomplete implementation of github.com/abu-lang/goabu.Agent based on github.com/libp2p/go-libp2p-pubsub.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	// contains filtered or unexported fields
}

Agent is an implementation of github.com/abu-lang/goabu.Agent based on github.com/libp2p/go-libp2p-pubsub.

func (*Agent) ForAll

func (a *Agent) ForAll(payload []byte) error

ForAll publishes the given payload.

func (*Agent) IsRunning

func (a *Agent) IsRunning() bool

IsRunning checks if the Agent is operational.

func (*Agent) Join

func (a *Agent) Join() error

Join is a no-op.

func (*Agent) ReceivedActions

func (a *Agent) ReceivedActions() (<-chan chan []byte, <-chan chan string)

ReceivedActions returns two channels passing a channel each for every received update. The []byte channel passes the marshalled update while the string channel is used for interacting with the github.com/abu-lang/goabu.Executer.

func (*Agent) SetLogLevel

func (a *Agent) SetLogLevel(l int)

SetLogLevel sets the log level of the Agent's logger.

func (*Agent) Start

func (a *Agent) Start() error

Start brings the Agent to a state where it is ready to accept incoming connections from other nodes and possibly starts mDNS node discovery.

func (*Agent) Stop

func (a *Agent) Stop() error

Stop brings the Agent to an halted stated by bringing down the connections to the other nodes.

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder can be used for Agent creation.

func NewBuilder

func NewBuilder() *Builder

NewBuilder creates a new Agent builder.

func (*Builder) Build

func (b *Builder) Build() *Agent

Build creates a new Agent

func (*Builder) WithLoggerOptions

func (b *Builder) WithLoggerOptions(conf config.LogConfig) *Builder

WithLoggerOptions configures the Agent's logger.

func (*Builder) WithMdns

func (b *Builder) WithMdns(tag string) *Builder

WithMdns set ups mDNS discovery with the passed non empty discovery tag string.

func (*Builder) WithPort

func (b *Builder) WithPort(port int) *Builder

WithPort configures the Agent to use a given listening port.

func (*Builder) WithPublishOptions

func (b *Builder) WithPublishOptions(opts ...pubsub.PubOpt) *Builder

WithPublishOptions configures the Agent to pass the given options when a message is published.

Jump to

Keyboard shortcuts

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