api

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2022 License: MIT Imports: 26 Imported by: 4

Documentation

Overview

Package api is all about the Network API. It contains the protobuf definition (under /pb), a Go client (under /client) and a gRPC service for the API backed by the threads network.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTestService added in v1.1.0

func CreateTestService(addr string, debug bool) (hostAddr ma.Multiaddr, gRPCAddr ma.Multiaddr, stop func(), err error)

CreateTestService creates a test network API gRPC service for test purpose. It uses either the addr passed in as host addr, or pick an available local addr if it is empty

Types

type Config

type Config struct {
	Debug bool
}

Config specifies service settings.

type Service

type Service struct {
	pb.UnimplementedAPIServer
	// contains filtered or unexported fields
}

Service is a gRPC service for a thread network.

func NewService

func NewService(network net.Net, conf Config) (*Service, error)

NewService starts and returns a new service.

func (*Service) AddRecord

func (s *Service) AddRecord(ctx context.Context, req *pb.AddRecordRequest) (*pb.AddRecordReply, error)

func (*Service) AddReplicator

func (s *Service) AddReplicator(ctx context.Context, req *pb.AddReplicatorRequest) (*pb.AddReplicatorReply, error)

func (*Service) AddThread

func (s *Service) AddThread(ctx context.Context, req *pb.AddThreadRequest) (*pb.ThreadInfoReply, error)

func (*Service) CreateRecord

func (s *Service) CreateRecord(ctx context.Context, req *pb.CreateRecordRequest) (*pb.NewRecordReply, error)

func (*Service) CreateThread

func (s *Service) CreateThread(ctx context.Context, req *pb.CreateThreadRequest) (*pb.ThreadInfoReply, error)

func (*Service) DeleteThread

func (s *Service) DeleteThread(ctx context.Context, req *pb.DeleteThreadRequest) (*pb.DeleteThreadReply, error)

func (*Service) GetHostID

func (s *Service) GetHostID(_ context.Context, _ *pb.GetHostIDRequest) (*pb.GetHostIDReply, error)

func (*Service) GetRecord

func (s *Service) GetRecord(ctx context.Context, req *pb.GetRecordRequest) (*pb.GetRecordReply, error)

func (*Service) GetThread

func (s *Service) GetThread(ctx context.Context, req *pb.GetThreadRequest) (*pb.ThreadInfoReply, error)

func (*Service) GetToken added in v0.1.13

func (s *Service) GetToken(server pb.API_GetTokenServer) error

func (*Service) PullThread

func (s *Service) PullThread(ctx context.Context, req *pb.PullThreadRequest) (*pb.PullThreadReply, error)

func (*Service) Subscribe

func (s *Service) Subscribe(req *pb.SubscribeRequest, server pb.API_SubscribeServer) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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