docrpc

package
v1.85.2 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(
	addr net.Addr, m docmarshal.Marshaler, opts ...grpc.DialOption,
) (document.Service, error)

NewClient returns a grpc-based client that satisfies Service by relaying operations to remote datastore server. See NewServer for more details.

func RegisterCollectionDocumentService

func RegisterCollectionDocumentService(
	registrar grpc.ServiceRegistrar, srv docpb.DocumentStoreServer, collection string,
)

RegisterCollectionDocumentService registers the given srv with the given registrar with a custom service description name, that enables registering one service per collection. Client.InitWithCollection should be used on the client side to talk to a service registered via this function.

Types

type Client

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

func (*Client) Close

func (c *Client) Close() error

func (*Client) Create

func (c *Client) Create(
	ctx context.Context, ID string, data any,
) error

func (*Client) Delete

func (c *Client) Delete(
	ctx context.Context, ID string,
) error

func (*Client) Get

func (c *Client) Get(
	ctx context.Context, ID string, doc any,
) error

func (*Client) Init

func (*Client) InitWithCollection

func (c *Client) InitWithCollection(
	cc grpc.ClientConnInterface, m docmarshal.Marshaler, collection string,
)

InitWithCollection initializes this Client with the given grpc connection, encoding marhshaler, and uses collection to suffix the service descriptor to enable multiple collection services registered in the same server. Server should be registered with grpc via RegisterCollectionDocumentService.

func (*Client) List

func (c *Client) List(
	ctx context.Context, filters []document.Filter,
) (document.Iterator, error)

func (*Client) Set

func (c *Client) Set(
	ctx context.Context, ID string, data any,
) error

func (*Client) Update

func (c *Client) Update(
	ctx context.Context, ID string, updates []document.Update,
	preconds ...document.Precondition,
) error

type Server

type Server struct {
	docpb.UnimplementedDocumentStoreServer
	// contains filtered or unexported fields
}

Server wraps another document.Service and exposes it through a grpc interface.

func NewServer

func NewServer(other document.Service, m docmarshal.Marshaler) *Server

NewServer allocates storage for a new Server and initializes it.

func (*Server) Create

func (s *Server) Create(
	ctx context.Context, req *docpb.CreateDocumentRequest,
) (res *docpb.CreateDocumentResponse, err error)

Create satisfies proto.DocumentStoreServer

func (*Server) Delete

func (s *Server) Delete(
	ctx context.Context, req *docpb.DeleteDocumentRequest,
) (res *docpb.DocumentResponse, err error)

Delete satisfies proto.DocumentStoreServer

func (*Server) Get

func (s *Server) Get(
	ctx context.Context, req *docpb.GetDocumentRequest,
) (res *docpb.GetDocumentResponse, err error)

Get satisfies proto.DocumentStoreServer

func (*Server) Init

func (s *Server) Init(other document.Service, m docmarshal.Marshaler)

func (*Server) List

List satisfies proto.DocumentStoreServer

func (*Server) Set

func (s *Server) Set(
	ctx context.Context, req *docpb.SetDocumentRequest,
) (res *docpb.DocumentResponse, err error)

Set satisfies proto.DocumentStoreServer

func (*Server) Update

Update satisfies proto.DocumentStoreServer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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