protocol

package
v0.0.0-...-49f93d6 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: MIT Imports: 21 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DefaultPrefix protocol.ID = "/ipfs"
)

Protocol ID

Variables

View Source
var ErrReadTimeout = fmt.Errorf("timed out reading response")

ErrReadTimeout is an error that occurs when no message is read within the timeout period.

Functions

This section is empty.

Types

type ClientOption

type ClientOption func(*clientConfig) error

Option type for smart records

func ClientProtocolPrefix

func ClientProtocolPrefix(p protocol.ID) ClientOption

ClientProtocolPrefix configures the smart-record client protocol ID prefix.

type ServerOption

type ServerOption func(*serverConfig) error

Option type for smart records

func Assembler

func Assembler(asm ir.AssemblerContext) ServerOption

Assembler configures the assembler to use in the smart record VM

func ServerProtocolPrefix

func ServerProtocolPrefix(p protocol.ID) ServerOption

ServerProtocolPrefix configures the smart-record client protocol ID prefix.

func UpdateContext

func UpdateContext(uc ir.UpdateContext) ServerOption

UpdateContext configures the context to use for updates in the smart record VM

func VMGcPeriod

func VMGcPeriod(gcP time.Duration) ServerOption

VMGcPeriod configures the garbage collection granularity in the server VM.

type SmartRecordClient

type SmartRecordClient interface {
	Get(ctx context.Context, k string, p peer.ID) (*vm.RecordValue, error)
	Update(ctx context.Context, k string, p peer.ID, rec xr.Dict, ttl time.Duration) error
}

SmartRecordClient sends smart-record requesets to other peers.

func NewSmartRecordClient

func NewSmartRecordClient(ctx context.Context, h host.Host, options ...ClientOption) (SmartRecordClient, error)

NewSmartRecordClient starts a smartRecordClient instance

type SmartRecordServer

type SmartRecordServer interface {
	UpdateLocal(k string, p peer.ID, rec xr.Dict, ttl time.Duration) error
	GetLocal(k string) vm.RecordValue
	// contains filtered or unexported methods
}

func NewSmartRecordServer

func NewSmartRecordServer(ctx context.Context, h host.Host, options ...ServerOption) (SmartRecordServer, error)

NewSmartRecordServer starts a smartRecordServer instance

Directories

Path Synopsis
example module

Jump to

Keyboard shortcuts

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