Documentation ¶
Index ¶
Constants ¶
const (
DefaultPrefix protocol.ID = "/ipfs"
)
Protocol ID
Variables ¶
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