view

package
v0.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: Apache-2.0, MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Constraint

type Constraint func(ConstraintStruct) error

type ConstraintStruct

type ConstraintStruct = api.View_Constraint

type FutureRecord

type FutureRecord api.View_MaybeRecord_Future

func (FutureRecord) Await

func (f FutureRecord) Await(ctx context.Context) (routing.Record, error)

func (FutureRecord) Record

func (f FutureRecord) Record() (routing.Record, error)

type Iterator

type Iterator casm.Iterator[routing.Record]

Iterator is a stateful object that enumerates routing records. See casm.Iterator() for important information on lifetime and error handling.

func (Iterator) Err

func (it Iterator) Err() error

Err reports any error encountered during iteration. Next will always return nil when Err() != nil.

func (Iterator) Next

func (it Iterator) Next() routing.Record

Next upates the iterator's internal state and returns the next record in the stream. If a call to Next returns nil, the iterator is exhausted.

Records returned by Next are valid until the next call to Next, or until the iterator is released. See View.Iter().

type Query

type Query func(QueryParams) error

func NewQuery

func NewQuery(s Selector, cs ...Constraint) Query

type QueryParams

type QueryParams interface {
	NewSelector() (api.View_Selector, error)
	NewConstraints(int32) (api.View_Constraint_List, error)
}

type RecordBinder

type RecordBinder interface {
	BindRecord(api.View_Record) error
}

type Selector

type Selector func(SelectorStruct) error

func All

func All() Selector

func From

func From(index routing.Index) Selector

func Match

func Match(index routing.Index) Selector

type SelectorStruct

type SelectorStruct = api.View_Selector

type Server

type Server struct {
	RoutingTable interface {
		Snapshot() routing.Snapshot
	}
}

func (Server) Client

func (s Server) Client() capnp.Client

func (Server) Iter

func (s Server) Iter(ctx context.Context, call api.View_iter) error

func (Server) Lookup

func (s Server) Lookup(ctx context.Context, call api.View_lookup) error

func (Server) Reverse

func (s Server) Reverse(ctx context.Context, call api.View_reverse) error

func (Server) View

func (s Server) View() View

type View

type View api.View

func (View) AddRef

func (v View) AddRef() View

func (View) Iter

func (v View) Iter(ctx context.Context, query Query) (Iterator, capnp.ReleaseFunc)

Iter returns an iterator that ranges over records matching the supplied query. Callers MUST call the ReleaseFunc when finished with the iterator. Callers MUST NOT call methods on the iterator after calling the ReleaseFunc.

func (View) Lookup

func (v View) Lookup(ctx context.Context, query Query) (FutureRecord, capnp.ReleaseFunc)

Lookup returns the first record to match the supplied query. Callers MUST call ReleaseFunc when finished. Note that this will invalidate any record returned by FutureRecord.

func (View) Release

func (v View) Release()

Directories

Path Synopsis
Package test_view is a generated GoMock package.
Package test_view is a generated GoMock package.

Jump to

Keyboard shortcuts

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