object

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BoltBucket = []byte("data")
View Source
var ErrBoltNoBucket = errors.New("no bucket in bolt")

Functions

This section is empty.

Types

type BoltStore

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

Store implementation using bbolt Internally it uses a single bucket to store all data Internal storage format is not stable. Do not rely on it. Note: insertions to bolt are comically slow unless batched.

The key is the name of the object as a TLV encoded byte slice
The value is the 8-byte version (big endian), followed by data wire

func NewBoltStore

func NewBoltStore(path string) (*BoltStore, error)

func (*BoltStore) Begin

func (s *BoltStore) Begin() error

func (*BoltStore) Close

func (s *BoltStore) Close() error

func (*BoltStore) Commit

func (s *BoltStore) Commit() error

func (*BoltStore) Get

func (s *BoltStore) Get(name enc.Name, prefix bool) (wire []byte, err error)

func (*BoltStore) Put

func (s *BoltStore) Put(name enc.Name, version uint64, wire []byte) error

func (*BoltStore) Remove

func (s *BoltStore) Remove(name enc.Name, prefix bool) error

func (*BoltStore) Rollback

func (s *BoltStore) Rollback() error

type Client

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

func NewClient

func NewClient(engine ndn.Engine, store ndn.Store) *Client

func (*Client) Consume

func (c *Client) Consume(name enc.Name, callback ConsumeCallback)

func (*Client) Engine

func (c *Client) Engine() ndn.Engine

func (*Client) ExpressR

func (c *Client) ExpressR(args ExpressRArgs, callback ndn.ExpressCallbackFunc)

(advanced) express a single interest with reliability

func (*Client) Produce

func (c *Client) Produce(args ProduceArgs) (enc.Name, error)

func (*Client) Start

func (c *Client) Start() error

func (*Client) Stop

func (c *Client) Stop()

type ConsumeCallback

type ConsumeCallback func(status *ConsumeState) bool

callback for consume API return true to continue fetching the object

type ConsumeState

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

arguments for the consume callback

func (*ConsumeState) Content

func (a *ConsumeState) Content() []byte

returns the currently available buffer in the content any subsequent calls to Content() will return data after the previous call

func (*ConsumeState) Error

func (a *ConsumeState) Error() error

returns the error that occurred during fetching

func (*ConsumeState) IsComplete

func (a *ConsumeState) IsComplete() bool

returns true if the content has been completely fetched

func (*ConsumeState) Name

func (a *ConsumeState) Name() enc.Name

returns the name of the object being consumed

func (*ConsumeState) Progress

func (a *ConsumeState) Progress() int

get the progress counter

func (*ConsumeState) ProgressMax

func (a *ConsumeState) ProgressMax() int

get the max value for the progress counter (-1 for unknown)

type ExpressRArgs

type ExpressRArgs struct {
	Name     enc.Name
	Config   *ndn.InterestConfig
	AppParam enc.Wire
	Signer   ndn.Signer
	Retries  int
	// contains filtered or unexported fields
}

arguments for the express retry API

type MemoryStore

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

func NewMemoryStore

func NewMemoryStore() *MemoryStore

func (*MemoryStore) Begin

func (s *MemoryStore) Begin() error

func (*MemoryStore) Commit

func (s *MemoryStore) Commit() error

func (*MemoryStore) Get

func (s *MemoryStore) Get(name enc.Name, prefix bool) ([]byte, error)

func (*MemoryStore) Put

func (s *MemoryStore) Put(name enc.Name, version uint64, wire []byte) error

func (*MemoryStore) Remove

func (s *MemoryStore) Remove(name enc.Name, prefix bool) error

func (*MemoryStore) Rollback

func (s *MemoryStore) Rollback() error

type ProduceArgs

type ProduceArgs struct {
	// name of the object to produce
	Name enc.Name
	// raw data contents
	Content enc.Wire
	// version of the object (defaults to unix timestamp, 0 for immutable)
	Version *uint64
	// time for which the object version can be cached (default 4s)
	FreshnessPeriod time.Duration
	// final expiry of the object (default 0 = no expiry)
	Expiry time.Time // TODO: not implemented
}

Jump to

Keyboard shortcuts

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