Documentation
¶
Index ¶
- type Handler
- type Instance
- func (i *Instance) Close(ctx context.Context) error
- func (i *Instance) Delete(ctx context.Context) error
- func (i *Instance) DoClose(ctx context.Context, ...) error
- func (i *Instance) DoCommand(ctx context.Context, ...) (interface{}, error)
- func (i *Instance) DoCommandStream(ctx context.Context, ...) (<-chan interface{}, error)
- func (i *Instance) DoCreate(ctx context.Context, ...) error
- func (i *Instance) DoQuery(ctx context.Context, ...) (interface{}, error)
- func (i *Instance) DoQueryStream(ctx context.Context, ...) (<-chan interface{}, error)
- type Metadata
- type MetadataOption
- type Name
- type Partition
- type Primitive
- type Session
- type SessionOption
- type Stream
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler interface {
// Create is called to create the session
Create(ctx context.Context, instance *Instance) error
// Close is called to close the primitive
Close(ctx context.Context, instance *Instance) error
// Delete is called to delete the primitive
Delete(ctx context.Context, instance *Instance) error
}
Handler provides session management for a primitive implementation
type Instance ¶
Instance is a primitive instance
func NewInstance ¶
func NewInstance(ctx context.Context, name Name, session *Session, handler Handler) (*Instance, error)
NewInstance creates a new primitive instance
func (*Instance) DoClose ¶
func (i *Instance) DoClose(ctx context.Context, f func(ctx context.Context, conn *grpc.ClientConn, header *headers.RequestHeader) (*headers.ResponseHeader, interface{}, error)) error
DoClose sends a session close request
func (*Instance) DoCommand ¶
func (i *Instance) DoCommand(ctx context.Context, f func(ctx context.Context, conn *grpc.ClientConn, header *headers.RequestHeader) (*headers.ResponseHeader, interface{}, error)) (interface{}, error)
DoCommand sends a session command request
func (*Instance) DoCommandStream ¶
func (i *Instance) DoCommandStream( ctx context.Context, f func(ctx context.Context, conn *grpc.ClientConn, header *headers.RequestHeader) (interface{}, error), responseFunc func(interface{}) (*headers.ResponseHeader, interface{}, error)) (<-chan interface{}, error)
DoCommandStream sends a session command stream request
func (*Instance) DoCreate ¶
func (i *Instance) DoCreate(ctx context.Context, f func(ctx context.Context, conn *grpc.ClientConn, header *headers.RequestHeader) (*headers.ResponseHeader, interface{}, error)) error
DoCreate sends a create session request
func (*Instance) DoQuery ¶
func (i *Instance) DoQuery(ctx context.Context, f func(ctx context.Context, conn *grpc.ClientConn, header *headers.RequestHeader) (*headers.ResponseHeader, interface{}, error)) (interface{}, error)
DoQuery sends a session query request
func (*Instance) DoQueryStream ¶
func (i *Instance) DoQueryStream( ctx context.Context, f func(ctx context.Context, conn *grpc.ClientConn, header *headers.RequestHeader) (interface{}, error), responseFunc func(interface{}) (*headers.ResponseHeader, interface{}, error)) (<-chan interface{}, error)
DoQueryStream sends a session query stream request
type Metadata ¶
type Metadata struct {
// Type is the primitive type
Type Type
// Name is the primitive name
Name Name
}
Metadata is primitive metadata
type MetadataOption ¶
type MetadataOption interface {
// contains filtered or unexported methods
}
MetadataOption implements a session metadata option
func WithNamespace ¶
func WithNamespace(namespace string) MetadataOption
WithNamespace returns a metadata option limiting a query by namespace
func WithPrimitiveType ¶
func WithPrimitiveType(primitiveType Type) MetadataOption
WithPrimitiveType returns a metadata option limiting a query by primitive type
type Name ¶
type Name struct {
// Namespace is the namespace within which the database is stored
Namespace string
// Database is the database in which the primitive is stored
Database string
// Application is the name of the application that owns the primitive
// Deprecated: Use Scope instead
Application string
// Scope is the application scope in which the primitive is stored
Scope string
// Name is the simple name of the primitive
Name string
}
Name is a qualified primitive name consisting of Namespace, Database, Application, and Name
type Partition ¶
type Partition struct {
// ID is the partition identifier
ID int
// Address is the partition address
Address net.Address
}
Partition is the ID and address for a partition
type Primitive ¶
type Primitive interface {
// Name returns the fully namespaced primitive name
Name() Name
// Close closes the primitive
Close(ctx context.Context) error
// Delete deletes the primitive state from the cluster
Delete(ctx context.Context) error
}
Primitive is the base interface for primitives
type Session ¶
type Session struct {
Partition int
Timeout time.Duration
SessionID uint64
// contains filtered or unexported fields
}
Session maintains the session for a primitive
func NewSession ¶
NewSession creates a new Session for the given partition name is the name of the primitive handler is the primitive's session handler
func (*Session) GetPrimitives ¶
GetPrimitives gets a list of primitives in the partition
type SessionOption ¶
type SessionOption interface {
// contains filtered or unexported methods
}
SessionOption implements a session option
func WithSessionTimeout ¶
func WithSessionTimeout(timeout time.Duration) SessionOption
WithSessionTimeout returns a session SessionOption to configure the session timeout