bots

package
v0.7.8 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BotIpfsHandler

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

BotIpfsHandler implements shared.IpfsHandler. Extends it by hanging on the the botID

func (BotIpfsHandler) Add

func (mip BotIpfsHandler) Add(data []byte, encrypt bool) (hash string, key string, err error)

Add allows a bot to add data to IPFS. currently it does not pin the data, only adds.

func (BotIpfsHandler) Get

func (mip BotIpfsHandler) Get(pth string, key string) ([]byte, error)

Get allows a bot to get IPFS data by the cid/path. Allows optional key for decryption on the fly

type Datastore added in v0.7.5

type Datastore struct {
	Namespace ds.Key
	// contains filtered or unexported fields
}

Datastore implements shared.Botstore. Extends it with BotID and BotVersion

func (Datastore) Close added in v0.7.5

func (kv Datastore) Close() error

Close not used by bots but required by ds.Datastore

func (Datastore) Delete added in v0.7.5

func (kv Datastore) Delete(key ds.Key) error

Delete allows a bot to delete a value in the kv store

func (Datastore) Get added in v0.7.5

func (kv Datastore) Get(key ds.Key) (data []byte, err error)

Get allows a bot to get a value by string. It responds with the version of the bot that wrote the data.

func (Datastore) GetSize added in v0.7.5

func (kv Datastore) GetSize(key ds.Key) (size int, err error)

GetSize returns the size of a value

func (Datastore) Has added in v0.7.5

func (kv Datastore) Has(key ds.Key) (exists bool, err error)

Has returns true if key exists

func (Datastore) Put added in v0.7.5

func (kv Datastore) Put(key ds.Key, data []byte) error

Put allows a bot to add a key-val to the store

func (Datastore) Query added in v0.7.5

func (kv Datastore) Query(query.Query) (query.Results, error)

Query not used by bots but required by ds.Datastore

type Service

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

Service holds a map to all running bots on this node

func NewService

func NewService(node *core.Textile) *Service

NewService returns a new bot service

func (*Service) Create

func (s *Service) Create(botID string, botVersion int, name string, params map[string]string, pth string)

Create configures the Bot rpc instance

func (*Service) Delete

func (s *Service) Delete(botID string, q []byte) (shared.Response, error)

Delete runs the bot.Delete method

func (*Service) Exists

func (s *Service) Exists(id string) bool

Exists is a helper to check if a bot exists

func (*Service) Get

func (s *Service) Get(botID string, q []byte) (shared.Response, error)

Get runs the bot.Get method

func (*Service) List added in v0.7.4

func (s *Service) List() *pb.ActiveBotList

List returns the id of all running bots

func (*Service) Post

func (s *Service) Post(botID string, q []byte, body []byte) (shared.Response, error)

Post runs the bot.Post method

func (*Service) Put

func (s *Service) Put(botID string, q []byte, body []byte) (shared.Response, error)

Put runs the bot.Put method

func (*Service) RunAll

func (s *Service) RunAll(repoPath string, bots []string)

RunAll runs a list of bots from Textile config

Jump to

Keyboard shortcuts

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