wrpc

package module
v0.0.0-...-db3db52 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendFloat32

func AppendFloat32(buf []byte, x float32) []byte

func AppendFloat64

func AppendFloat64(buf []byte, x float64) []byte

func AppendUint16

func AppendUint16(buf []byte, x uint16) []byte

func AppendUint32

func AppendUint32(buf []byte, x uint32) []byte

func AppendUint64

func AppendUint64(buf []byte, x uint64) []byte

func FlattenOption

func FlattenOption[T any](v **T) *T

func PutFloat32

func PutFloat32(buf []byte, x float32)

func PutFloat64

func PutFloat64(buf []byte, x float64)

func PutUint16

func PutUint16(buf []byte, x uint16)

func PutUint32

func PutUint32(buf []byte, x uint32)

func PutUint64

func PutUint64(buf []byte, x uint64)

func ReadByteList

func ReadByteList(r ByteReader) ([]byte, error)

ReadByteList reads a []byte from `r` and returns it

func ReadFlatOption

func ReadFlatOption[T any](r IndexReader, f func(IndexReader) (T, error)) (v T, err error)

ReadFlatOption reads an option from `r` without pointer indirection

func ReadFutureStatus

func ReadFutureStatus(r ByteReader) (bool, error)

ReadFutureStatus reads a single byte from `r` and returns: - `true` if future is "ready" - `false` if future is "pending"

func ReadList

func ReadList[T any](r IndexReader, f func(IndexReader) (T, error)) ([]T, error)

ReadList reads a list from `r` and returns it

func ReadOption

func ReadOption[T any](r ByteReader, f func(ByteReader) (T, error)) (*T, error)

ReadOption reads an option from `r`

func ReadOptionStatus

func ReadOptionStatus(r ByteReader) (bool, error)

ReadOptionStatus reads a single byte from `r` and returns: - `true` for `option::some` - `false` for `option::none`

func ReadResultStatus

func ReadResultStatus(r ByteReader) (bool, error)

ReadResultStatus reads a single byte from `r` and returns: - `true` for `result::ok` - `false` for `result::err`

func ReadStreamStatus

func ReadStreamStatus(r ByteReader) (bool, error)

ReadStreamStatus reads a single byte from `r` and returns: - `true` if stream is "ready" - `false` if stream is "pending"

func ReadString

func ReadString(r ByteReader) (string, error)

ReadString reads a string from `r` and returns it

func ReadUint16

func ReadUint16(r ByteReader) (uint16, error)

ReadUint16 reads an encoded uint16 from r and returns it. The error is io.EOF only if no bytes were read. If an io.EOF happens after reading some but not all the bytes, ReadUvarint returns io.ErrUnexpectedEOF.

func ReadUint32

func ReadUint32(r ByteReader) (uint32, error)

ReadUint32 reads an encoded uint32 from r and returns it. The error is io.EOF only if no bytes were read. If an io.EOF happens after reading some but not all the bytes, ReadUvarint returns io.ErrUnexpectedEOF.

func ReadUint64

func ReadUint64(r ByteReader) (uint64, error)

ReadUint64 reads an encoded uint64 from r and returns it. The error is io.EOF only if no bytes were read. If an io.EOF happens after reading some but not all the bytes, ReadUvarint returns io.ErrUnexpectedEOF.

func Slice

func Slice[T any](v []T) *[]T

func WriteByteList

func WriteByteList(v []byte, w ByteWriter) error

func WriteList

func WriteList[T any](v []T, w ByteWriter, f func(T, ByteWriter) error) error

func WriteOption

func WriteOption[T any](v *T, w ByteWriter, f func(T, ByteWriter) error) error

func WriteString

func WriteString(v string, w ByteWriter) error

func WriteUint16

func WriteUint16(v uint16, w ByteWriter) error

func WriteUint32

func WriteUint32(v uint32, w ByteWriter) error

func WriteUint64

func WriteUint64(v uint64, w ByteWriter) error

func WriteUint8

func WriteUint8(v uint8, w ByteWriter) error

Types

type Borrow

type Borrow[T any] string

Borrow is a borrowed resource handle

type ByteReadCompleter

type ByteReadCompleter interface {
	ByteReader
	Completer
}

type ByteReader

type ByteReader interface {
	io.ByteReader
	io.Reader
}

type ByteStreamReader

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

func NewByteStreamReader

func NewByteStreamReader(r ByteReadCompleter) *ByteStreamReader

func (*ByteStreamReader) Close

func (r *ByteStreamReader) Close() error

func (*ByteStreamReader) IsComplete

func (r *ByteStreamReader) IsComplete() bool

func (*ByteStreamReader) Read

func (r *ByteStreamReader) Read(p []byte) (int, error)

type ByteStreamWriter

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

func WriteByteStream

func WriteByteStream(r ReadCompleter, w ByteWriter, chunk []byte, path ...uint32) (*ByteStreamWriter, error)

func (*ByteStreamWriter) WriteTo

func (v *ByteStreamWriter) WriteTo(w ByteWriter) (err error)

type ByteWriter

type ByteWriter interface {
	io.ByteWriter
	io.Writer
}

type CompleteByteReader

type CompleteByteReader struct {
	ByteReader
}

func NewCompleteByteReader

func NewCompleteByteReader(r ByteReader) *CompleteByteReader

func (*CompleteByteReader) IsComplete

func (*CompleteByteReader) IsComplete() bool

type CompleteReader

type CompleteReader struct {
	io.Reader
}

func NewCompleteReader

func NewCompleteReader(r io.Reader) *CompleteReader

func (*CompleteReader) IsComplete

func (*CompleteReader) IsComplete() bool

type CompleteReceiver

type CompleteReceiver[T any] struct {
	// contains filtered or unexported fields
}

func NewCompleteReceiver

func NewCompleteReceiver[T any](v T) *CompleteReceiver[T]

func (*CompleteReceiver[T]) IsComplete

func (*CompleteReceiver[T]) IsComplete() bool

func (*CompleteReceiver[T]) Receive

func (r *CompleteReceiver[T]) Receive() (T, error)

type Completer

type Completer interface {
	IsComplete() bool
}

type DecodeReceiver

type DecodeReceiver[T any] struct {
	// contains filtered or unexported fields
}

func NewDecodeReceiver

func NewDecodeReceiver[T any](r IndexReader, decode func(IndexReader) (T, error)) *DecodeReceiver[T]

func (*DecodeReceiver[T]) Close

func (r *DecodeReceiver[T]) Close() error

func (*DecodeReceiver[T]) IsComplete

func (*DecodeReceiver[T]) IsComplete() bool

func (*DecodeReceiver[T]) Receive

func (r *DecodeReceiver[T]) Receive() (T, error)

type Index

type Index[T any] interface {
	Index(path ...uint32) (T, error)
}

type IndexReadCloser

type IndexReadCloser interface {
	IndexReader
	io.Closer
}

type IndexReader

type IndexReader interface {
	io.Reader
	io.ByteReader

	Index[IndexReader]
}

type IndexWriter

type IndexWriter interface {
	io.Writer
	io.ByteWriter

	Index[IndexWriter]
}

type Invoker

type Invoker interface {
	Invoke(ctx context.Context, instance string, name string, f func(IndexWriter, IndexReadCloser) error, subs ...SubscribePath) error
}

type Own

type Own[T any] string

Own is an owned resource handle

func (Own[T]) Borrow

func (v Own[T]) Borrow() Borrow[T]

func (Own[T]) Drop

func (v Own[T]) Drop(ctx context.Context, c Invoker) error

type PendingByteReader

type PendingByteReader struct {
	ByteReader
}

func NewPendingByteReader

func NewPendingByteReader(r ByteReader) *PendingByteReader

func (*PendingByteReader) IsComplete

func (*PendingByteReader) IsComplete() bool

type PendingReader

type PendingReader struct {
	io.Reader
}

func NewPendingReader

func NewPendingReader(r io.Reader) *PendingReader

func (*PendingReader) IsComplete

func (*PendingReader) IsComplete() bool

type PendingReceiver

type PendingReceiver[T any] struct {
	Receiver[T]
}

func NewPendingReceiver

func NewPendingReceiver[T any](rx Receiver[T]) *PendingReceiver[T]

func (*PendingReceiver[T]) IsComplete

func (*PendingReceiver[T]) IsComplete() bool

func (*PendingReceiver[T]) Receive

func (r *PendingReceiver[T]) Receive() (T, error)

type ReadCompleter

type ReadCompleter interface {
	io.Reader
	Completer
}

func ReadByteStream

func ReadByteStream(r IndexReader, path ...uint32) (ReadCompleter, error)

ReadByteStream reads a stream of bytes from `r`

type ReceiveCompleter

type ReceiveCompleter[T any] interface {
	Receiver[T]
	Completer
}

func ReadFuture

func ReadFuture[T any](r IndexReader, f func(IndexReader) (T, error), path ...uint32) (ReceiveCompleter[T], error)

ReadFuture reads a future from `r` and `ch`

func ReadStream

func ReadStream[T any](r IndexReader, f func(IndexReader) (T, error), path ...uint32) (ReceiveCompleter[[]T], error)

ReadStream reads a stream from `r`

type Receiver

type Receiver[T any] interface {
	Receive() (T, error)
}

type Result

type Result[Ok, Err any] struct {
	Ok  *Ok
	Err *Err
}

func Err

func Err[Ok, Err any](v Err) *Result[Ok, Err]

func Ok

func Ok[Err, Ok any](v Ok) *Result[Ok, Err]

func ReadResult

func ReadResult[T, U any](r ByteReader, fOk func(ByteReader) (T, error), fErr func(ByteReader) (U, error)) (*Result[T, U], error)

ReadResult reads a single byte from `r`

func (*Result[Ok, Err]) WriteTo

func (v *Result[Ok, Err]) WriteTo(w ByteWriter, fOk func(*Ok, ByteWriter) error, fErr func(*Err, ByteWriter) error) error

type Server

type Server interface {
	Serve(instance string, name string, f func(context.Context, IndexWriter, IndexReadCloser) error, subs ...SubscribePath) (func() error, error)
}

type SubscribePath

type SubscribePath []*uint32

func NewSubscribePath

func NewSubscribePath(ps ...*uint32) SubscribePath

func (SubscribePath) Index

func (p SubscribePath) Index(i uint32) SubscribePath

func (SubscribePath) Parent

func (p SubscribePath) Parent() (SubscribePath, bool)

func (SubscribePath) Wildcard

func (p SubscribePath) Wildcard() SubscribePath

type Tuple10

type Tuple10[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 any] struct {
	V0 T0
	V1 T1
	V2 T2
	V3 T3
	V4 T4
	V5 T5
	V6 T6
	V7 T7
	V8 T8
	V9 T9
}

type Tuple11

type Tuple11[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 any] struct {
	V0  T0
	V1  T1
	V2  T2
	V3  T3
	V4  T4
	V5  T5
	V6  T6
	V7  T7
	V8  T8
	V9  T9
	V10 T10
}

type Tuple12

type Tuple12[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11 any] struct {
	V0  T0
	V1  T1
	V2  T2
	V3  T3
	V4  T4
	V5  T5
	V6  T6
	V7  T7
	V8  T8
	V9  T9
	V10 T10
	V11 T11
}

type Tuple13

type Tuple13[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12 any] struct {
	V0  T0
	V1  T1
	V2  T2
	V3  T3
	V4  T4
	V5  T5
	V6  T6
	V7  T7
	V8  T8
	V9  T9
	V10 T10
	V11 T11
	V12 T12
}

type Tuple14

type Tuple14[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13 any] struct {
	V0  T0
	V1  T1
	V2  T2
	V3  T3
	V4  T4
	V5  T5
	V6  T6
	V7  T7
	V8  T8
	V9  T9
	V10 T10
	V11 T11
	V12 T12
	V13 T13
}

type Tuple15

type Tuple15[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 any] struct {
	V0  T0
	V1  T1
	V2  T2
	V3  T3
	V4  T4
	V5  T5
	V6  T6
	V7  T7
	V8  T8
	V9  T9
	V10 T10
	V11 T11
	V12 T12
	V13 T13
	V14 T14
}

type Tuple16

type Tuple16[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 any] struct {
	V0  T0
	V1  T1
	V2  T2
	V3  T3
	V4  T4
	V5  T5
	V6  T6
	V7  T7
	V8  T8
	V9  T9
	V10 T10
	V11 T11
	V12 T12
	V13 T13
	V14 T14
	V15 T15
}

type Tuple2

type Tuple2[T0, T1 any] struct {
	V0 T0
	V1 T1
}

func ReadTuple2

func ReadTuple2[T0, T1 any](r IndexReader, f0 func(IndexReader) (T0, error), f1 func(IndexReader) (T1, error)) (*Tuple2[T0, T1], error,
)

func (*Tuple2[T0, T1]) WriteTo

func (v *Tuple2[T0, T1]) WriteTo(w ByteWriter, f0 func(T0, ByteWriter) error, f1 func(T1, ByteWriter) error) error

type Tuple3

type Tuple3[T0, T1, T2 any] struct {
	V0 T0
	V1 T1
	V2 T2
}

func ReadTuple3

func ReadTuple3[T0, T1, T2 any](r IndexReader, f0 func(IndexReader) (T0, error), f1 func(IndexReader) (T1, error), f2 func(IndexReader) (T2, error)) (*Tuple3[T0, T1, T2], error,
)

func (*Tuple3[T0, T1, T2]) WriteTo

func (v *Tuple3[T0, T1, T2]) WriteTo(w ByteWriter, f0 func(T0, ByteWriter) error, f1 func(T1, ByteWriter) error, f2 func(T2, ByteWriter) error) error

type Tuple4

type Tuple4[T0, T1, T2, T3 any] struct {
	V0 T0
	V1 T1
	V2 T2
	V3 T3
}

type Tuple5

type Tuple5[T0, T1, T2, T3, T4 any] struct {
	V0 T0
	V1 T1
	V2 T2
	V3 T3
	V4 T4
}

type Tuple6

type Tuple6[T0, T1, T2, T3, T4, T5 any] struct {
	V0 T0
	V1 T1
	V2 T2
	V3 T3
	V4 T4
	V5 T5
}

type Tuple7

type Tuple7[T0, T1, T2, T3, T4, T5, T6 any] struct {
	V0 T0
	V1 T1
	V2 T2
	V3 T3
	V4 T4
	V5 T5
	V6 T6
}

type Tuple8

type Tuple8[T0, T1, T2, T3, T4, T5, T6, T7 any] struct {
	V0 T0
	V1 T1
	V2 T2
	V3 T3
	V4 T4
	V5 T5
	V6 T6
	V7 T7
}

type Tuple9

type Tuple9[T0, T1, T2, T3, T4, T5, T6, T7, T8 any] struct {
	V0 T0
	V1 T1
	V2 T2
	V3 T3
	V4 T4
	V5 T5
	V6 T6
	V7 T7
	V8 T8
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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