databroker

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: Apache-2.0 Imports: 27 Imported by: 6

Documentation ¶

Overview ¶

Package databroker contains databroker protobuf definitions.

Index ¶

Constants ¶

This section is empty.

Variables ¶

View Source
var File_databroker_proto protoreflect.FileDescriptor

Functions ¶

func Get ¶ added in v0.17.0

func Get(ctx context.Context, client DataBrokerServiceClient, object recordObject) error

Get gets a record from the databroker and unmarshals it into the object.

func GetViaJSON ¶ added in v0.20.0

func GetViaJSON[T any](ctx context.Context, client DataBrokerServiceClient, recordType, recordID string) (*T, error)

GetViaJSON gets a record from the databroker, marshals it to JSON, and then unmarshals it to the given type.

func RegisterDataBrokerServiceServer ¶

func RegisterDataBrokerServiceServer(s *grpc.Server, srv DataBrokerServiceServer)

Types ¶

type AcquireLeaseRequest ¶ added in v0.15.0

type AcquireLeaseRequest struct {

	// Name is the name of the lease. Only a single client can hold the lease on
	// the specified name at any one time.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Duration is the duration of the lease. After the duration is reached the
	// lease can be acquired by other clients.
	Duration *durationpb.Duration `protobuf:"bytes,2,opt,name=duration,proto3" json:"duration,omitempty"`
	// contains filtered or unexported fields
}

func (*AcquireLeaseRequest) Descriptor deprecated added in v0.15.0

func (*AcquireLeaseRequest) Descriptor() ([]byte, []int)

Deprecated: Use AcquireLeaseRequest.ProtoReflect.Descriptor instead.

func (*AcquireLeaseRequest) GetDuration ¶ added in v0.15.0

func (x *AcquireLeaseRequest) GetDuration() *durationpb.Duration

func (*AcquireLeaseRequest) GetName ¶ added in v0.15.0

func (x *AcquireLeaseRequest) GetName() string

func (*AcquireLeaseRequest) ProtoMessage ¶ added in v0.15.0

func (*AcquireLeaseRequest) ProtoMessage()

func (*AcquireLeaseRequest) ProtoReflect ¶ added in v0.15.0

func (x *AcquireLeaseRequest) ProtoReflect() protoreflect.Message

func (*AcquireLeaseRequest) Reset ¶ added in v0.15.0

func (x *AcquireLeaseRequest) Reset()

func (*AcquireLeaseRequest) String ¶ added in v0.15.0

func (x *AcquireLeaseRequest) String() string

type AcquireLeaseResponse ¶ added in v0.15.0

type AcquireLeaseResponse struct {

	// Id is the id of the acquired lease. Subsequent calls to release or renew
	// will need both the lease name and the lease id.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*AcquireLeaseResponse) Descriptor deprecated added in v0.15.0

func (*AcquireLeaseResponse) Descriptor() ([]byte, []int)

Deprecated: Use AcquireLeaseResponse.ProtoReflect.Descriptor instead.

func (*AcquireLeaseResponse) GetId ¶ added in v0.15.0

func (x *AcquireLeaseResponse) GetId() string

func (*AcquireLeaseResponse) ProtoMessage ¶ added in v0.15.0

func (*AcquireLeaseResponse) ProtoMessage()

func (*AcquireLeaseResponse) ProtoReflect ¶ added in v0.15.0

func (x *AcquireLeaseResponse) ProtoReflect() protoreflect.Message

func (*AcquireLeaseResponse) Reset ¶ added in v0.15.0

func (x *AcquireLeaseResponse) Reset()

func (*AcquireLeaseResponse) String ¶ added in v0.15.0

func (x *AcquireLeaseResponse) String() string

type DataBrokerServiceClient ¶

type DataBrokerServiceClient interface {
	// AcquireLease acquires a distributed mutex lease.
	AcquireLease(ctx context.Context, in *AcquireLeaseRequest, opts ...grpc.CallOption) (*AcquireLeaseResponse, error)
	// Get gets a record.
	Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error)
	// Put saves a record.
	Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error)
	// Query queries for records.
	Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error)
	// ReleaseLease releases a distributed mutex lease.
	ReleaseLease(ctx context.Context, in *ReleaseLeaseRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// RenewLease renews a distributed mutex lease.
	RenewLease(ctx context.Context, in *RenewLeaseRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// SetOptions sets the options for a type in the databroker.
	SetOptions(ctx context.Context, in *SetOptionsRequest, opts ...grpc.CallOption) (*SetOptionsResponse, error)
	// Sync streams changes to records after the specified version.
	Sync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (DataBrokerService_SyncClient, error)
	// SyncLatest streams the latest version of every record.
	SyncLatest(ctx context.Context, in *SyncLatestRequest, opts ...grpc.CallOption) (DataBrokerService_SyncLatestClient, error)
}

DataBrokerServiceClient is the client API for DataBrokerService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

type DataBrokerServiceServer ¶

type DataBrokerServiceServer interface {
	// AcquireLease acquires a distributed mutex lease.
	AcquireLease(context.Context, *AcquireLeaseRequest) (*AcquireLeaseResponse, error)
	// Get gets a record.
	Get(context.Context, *GetRequest) (*GetResponse, error)
	// Put saves a record.
	Put(context.Context, *PutRequest) (*PutResponse, error)
	// Query queries for records.
	Query(context.Context, *QueryRequest) (*QueryResponse, error)
	// ReleaseLease releases a distributed mutex lease.
	ReleaseLease(context.Context, *ReleaseLeaseRequest) (*emptypb.Empty, error)
	// RenewLease renews a distributed mutex lease.
	RenewLease(context.Context, *RenewLeaseRequest) (*emptypb.Empty, error)
	// SetOptions sets the options for a type in the databroker.
	SetOptions(context.Context, *SetOptionsRequest) (*SetOptionsResponse, error)
	// Sync streams changes to records after the specified version.
	Sync(*SyncRequest, DataBrokerService_SyncServer) error
	// SyncLatest streams the latest version of every record.
	SyncLatest(*SyncLatestRequest, DataBrokerService_SyncLatestServer) error
}

DataBrokerServiceServer is the server API for DataBrokerService service.

type DataBrokerService_SyncClient ¶

type DataBrokerService_SyncClient interface {
	Recv() (*SyncResponse, error)
	grpc.ClientStream
}

type DataBrokerService_SyncLatestClient ¶ added in v0.14.0

type DataBrokerService_SyncLatestClient interface {
	Recv() (*SyncLatestResponse, error)
	grpc.ClientStream
}

type DataBrokerService_SyncLatestServer ¶ added in v0.14.0

type DataBrokerService_SyncLatestServer interface {
	Send(*SyncLatestResponse) error
	grpc.ServerStream
}

type DataBrokerService_SyncServer ¶

type DataBrokerService_SyncServer interface {
	Send(*SyncResponse) error
	grpc.ServerStream
}

type GetRequest ¶

type GetRequest struct {
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	Id   string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*GetRequest) Descriptor deprecated

func (*GetRequest) Descriptor() ([]byte, []int)

Deprecated: Use GetRequest.ProtoReflect.Descriptor instead.

func (*GetRequest) GetId ¶

func (x *GetRequest) GetId() string

func (*GetRequest) GetType ¶

func (x *GetRequest) GetType() string

func (*GetRequest) ProtoMessage ¶

func (*GetRequest) ProtoMessage()

func (*GetRequest) ProtoReflect ¶

func (x *GetRequest) ProtoReflect() protoreflect.Message

func (*GetRequest) Reset ¶

func (x *GetRequest) Reset()

func (*GetRequest) String ¶

func (x *GetRequest) String() string

type GetResponse ¶

type GetResponse struct {
	Record *Record `protobuf:"bytes,1,opt,name=record,proto3" json:"record,omitempty"`
	// contains filtered or unexported fields
}

func (*GetResponse) Descriptor deprecated

func (*GetResponse) Descriptor() ([]byte, []int)

Deprecated: Use GetResponse.ProtoReflect.Descriptor instead.

func (*GetResponse) GetRecord ¶

func (x *GetResponse) GetRecord() *Record

func (*GetResponse) ProtoMessage ¶

func (*GetResponse) ProtoMessage()

func (*GetResponse) ProtoReflect ¶

func (x *GetResponse) ProtoReflect() protoreflect.Message

func (*GetResponse) Reset ¶

func (x *GetResponse) Reset()

func (*GetResponse) String ¶

func (x *GetResponse) String() string

type Leaser ¶ added in v0.15.0

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

A Leaser attempts to acquire a lease and if successful runs the handler. If the lease is released the context used for the handler will be canceled and a new lease acquisition will be attempted.

func NewLeaser ¶ added in v0.15.0

func NewLeaser(leaseName string, ttl time.Duration, handler LeaserHandler) *Leaser

NewLeaser creates a new Leaser.

func NewLeasers ¶ added in v0.17.3

func NewLeasers(leaseName string, ttl time.Duration, client DataBrokerServiceClient, handlers ...func(context.Context) error) *Leaser

NewLeasers creates a leaser using multiple handler functions

func (*Leaser) Run ¶ added in v0.15.0

func (locker *Leaser) Run(ctx context.Context) error

Run acquires the lease and runs the handler. This continues until either:

1. ctx is canceled 2. a non-cancel error is returned from handler

type LeaserHandler ¶ added in v0.15.0

type LeaserHandler interface {
	GetDataBrokerServiceClient() DataBrokerServiceClient
	RunLeased(ctx context.Context) error
}

A LeaserHandler is a handler for the locker.

type Options ¶ added in v0.14.0

type Options struct {

	// capacity sets a maximum size for the given type. Once the capacity is
	// reached the oldest records will be removed.
	Capacity *uint64 `protobuf:"varint,1,opt,name=capacity,proto3,oneof" json:"capacity,omitempty"`
	// contains filtered or unexported fields
}

Options are the options for a type stored in the databroker.

func (*Options) Descriptor deprecated added in v0.14.0

func (*Options) Descriptor() ([]byte, []int)

Deprecated: Use Options.ProtoReflect.Descriptor instead.

func (*Options) GetCapacity ¶ added in v0.14.0

func (x *Options) GetCapacity() uint64

func (*Options) ProtoMessage ¶ added in v0.14.0

func (*Options) ProtoMessage()

func (*Options) ProtoReflect ¶ added in v0.14.0

func (x *Options) ProtoReflect() protoreflect.Message

func (*Options) Reset ¶ added in v0.14.0

func (x *Options) Reset()

func (*Options) String ¶ added in v0.14.0

func (x *Options) String() string

type PutRequest ¶ added in v0.14.0

type PutRequest struct {
	Records []*Record `protobuf:"bytes,1,rep,name=records,proto3" json:"records,omitempty"`
	// contains filtered or unexported fields
}

func OptimumPutRequestsFromRecords ¶ added in v0.17.3

func OptimumPutRequestsFromRecords(records []*Record) []*PutRequest

OptimumPutRequestsFromRecords creates one or more PutRequests from a slice of records. If the size of the request exceeds the max message size it will be split in half recursively until the requests are less than or equal to the max message size.

func (*PutRequest) Descriptor deprecated added in v0.14.0

func (*PutRequest) Descriptor() ([]byte, []int)

Deprecated: Use PutRequest.ProtoReflect.Descriptor instead.

func (*PutRequest) GetRecord ¶ added in v0.14.0

func (x *PutRequest) GetRecord() *Record

GetRecord gets the first record, or nil if there are none.

func (*PutRequest) GetRecords ¶ added in v0.17.3

func (x *PutRequest) GetRecords() []*Record

func (*PutRequest) ProtoMessage ¶ added in v0.14.0

func (*PutRequest) ProtoMessage()

func (*PutRequest) ProtoReflect ¶ added in v0.14.0

func (x *PutRequest) ProtoReflect() protoreflect.Message

func (*PutRequest) Reset ¶ added in v0.14.0

func (x *PutRequest) Reset()

func (*PutRequest) String ¶ added in v0.14.0

func (x *PutRequest) String() string

type PutResponse ¶ added in v0.14.0

type PutResponse struct {
	ServerVersion uint64    `protobuf:"varint,1,opt,name=server_version,json=serverVersion,proto3" json:"server_version,omitempty"`
	Records       []*Record `protobuf:"bytes,2,rep,name=records,proto3" json:"records,omitempty"`
	// contains filtered or unexported fields
}

func Put ¶ added in v0.17.0

func Put(ctx context.Context, client DataBrokerServiceClient, objects ...recordObject) (*PutResponse, error)

Put puts a record into the databroker.

func (*PutResponse) Descriptor deprecated added in v0.14.0

func (*PutResponse) Descriptor() ([]byte, []int)

Deprecated: Use PutResponse.ProtoReflect.Descriptor instead.

func (*PutResponse) GetRecord ¶ added in v0.14.0

func (x *PutResponse) GetRecord() *Record

GetRecord gets the first record, or nil if there are none.

func (*PutResponse) GetRecords ¶ added in v0.17.3

func (x *PutResponse) GetRecords() []*Record

func (*PutResponse) GetServerVersion ¶ added in v0.14.0

func (x *PutResponse) GetServerVersion() uint64

func (*PutResponse) ProtoMessage ¶ added in v0.14.0

func (*PutResponse) ProtoMessage()

func (*PutResponse) ProtoReflect ¶ added in v0.14.0

func (x *PutResponse) ProtoReflect() protoreflect.Message

func (*PutResponse) Reset ¶ added in v0.14.0

func (x *PutResponse) Reset()

func (*PutResponse) String ¶ added in v0.14.0

func (x *PutResponse) String() string

type QueryRequest ¶ added in v0.11.0

type QueryRequest struct {
	Type   string           `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	Query  string           `protobuf:"bytes,2,opt,name=query,proto3" json:"query,omitempty"`
	Offset int64            `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"`
	Limit  int64            `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"`
	Filter *structpb.Struct `protobuf:"bytes,5,opt,name=filter,proto3" json:"filter,omitempty"`
	// contains filtered or unexported fields
}

func (*QueryRequest) Descriptor deprecated added in v0.11.0

func (*QueryRequest) Descriptor() ([]byte, []int)

Deprecated: Use QueryRequest.ProtoReflect.Descriptor instead.

func (*QueryRequest) GetFilter ¶ added in v0.18.0

func (x *QueryRequest) GetFilter() *structpb.Struct

func (*QueryRequest) GetLimit ¶ added in v0.11.0

func (x *QueryRequest) GetLimit() int64

func (*QueryRequest) GetOffset ¶ added in v0.11.0

func (x *QueryRequest) GetOffset() int64

func (*QueryRequest) GetQuery ¶ added in v0.11.0

func (x *QueryRequest) GetQuery() string

func (*QueryRequest) GetType ¶ added in v0.11.0

func (x *QueryRequest) GetType() string

func (*QueryRequest) ProtoMessage ¶ added in v0.11.0

func (*QueryRequest) ProtoMessage()

func (*QueryRequest) ProtoReflect ¶ added in v0.11.0

func (x *QueryRequest) ProtoReflect() protoreflect.Message

func (*QueryRequest) Reset ¶ added in v0.11.0

func (x *QueryRequest) Reset()

func (*QueryRequest) SetFilterByID ¶ added in v0.18.0

func (x *QueryRequest) SetFilterByID(id string)

SetFilterByID sets the filter to an id.

func (*QueryRequest) SetFilterByIDOrIndex ¶ added in v0.18.0

func (x *QueryRequest) SetFilterByIDOrIndex(idOrIndex string)

SetFilterByIDOrIndex sets the filter to an id or an index.

func (*QueryRequest) String ¶ added in v0.11.0

func (x *QueryRequest) String() string

type QueryResponse ¶ added in v0.11.0

type QueryResponse struct {
	Records       []*Record `protobuf:"bytes,1,rep,name=records,proto3" json:"records,omitempty"`
	TotalCount    int64     `protobuf:"varint,2,opt,name=total_count,json=totalCount,proto3" json:"total_count,omitempty"`
	ServerVersion uint64    `protobuf:"varint,3,opt,name=server_version,json=serverVersion,proto3" json:"server_version,omitempty"`
	RecordVersion uint64    `protobuf:"varint,4,opt,name=record_version,json=recordVersion,proto3" json:"record_version,omitempty"`
	// contains filtered or unexported fields
}

func (*QueryResponse) Descriptor deprecated added in v0.11.0

func (*QueryResponse) Descriptor() ([]byte, []int)

Deprecated: Use QueryResponse.ProtoReflect.Descriptor instead.

func (*QueryResponse) GetRecordVersion ¶ added in v0.18.0

func (x *QueryResponse) GetRecordVersion() uint64

func (*QueryResponse) GetRecords ¶ added in v0.11.0

func (x *QueryResponse) GetRecords() []*Record

func (*QueryResponse) GetServerVersion ¶ added in v0.18.0

func (x *QueryResponse) GetServerVersion() uint64

func (*QueryResponse) GetTotalCount ¶ added in v0.11.0

func (x *QueryResponse) GetTotalCount() int64

func (*QueryResponse) ProtoMessage ¶ added in v0.11.0

func (*QueryResponse) ProtoMessage()

func (*QueryResponse) ProtoReflect ¶ added in v0.11.0

func (x *QueryResponse) ProtoReflect() protoreflect.Message

func (*QueryResponse) Reset ¶ added in v0.11.0

func (x *QueryResponse) Reset()

func (*QueryResponse) String ¶ added in v0.11.0

func (x *QueryResponse) String() string

type Record ¶

type Record struct {
	Version    uint64                 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"`
	Type       string                 `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
	Id         string                 `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"`
	Data       *anypb.Any             `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"`
	ModifiedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=modified_at,json=modifiedAt,proto3" json:"modified_at,omitempty"`
	DeletedAt  *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=deleted_at,json=deletedAt,proto3" json:"deleted_at,omitempty"`
	// contains filtered or unexported fields
}

func ApplyOffsetAndLimit ¶ added in v0.11.0

func ApplyOffsetAndLimit(all []*Record, offset, limit int) (records []*Record, totalCount int)

ApplyOffsetAndLimit applies the offset and limit to the list of records.

func InitialSync ¶ added in v0.11.0

func InitialSync(
	ctx context.Context,
	client DataBrokerServiceClient,
	req *SyncLatestRequest,
) (records []*Record, recordVersion, serverVersion uint64, err error)

InitialSync performs a sync latest and then returns all the results.

func NewRecord ¶ added in v0.17.0

func NewRecord(object recordObject) *Record

NewRecord creates a new Record.

func (*Record) Descriptor deprecated

func (*Record) Descriptor() ([]byte, []int)

Deprecated: Use Record.ProtoReflect.Descriptor instead.

func (*Record) GetData ¶

func (x *Record) GetData() *anypb.Any

func (*Record) GetDeletedAt ¶

func (x *Record) GetDeletedAt() *timestamppb.Timestamp

func (*Record) GetId ¶

func (x *Record) GetId() string

func (*Record) GetModifiedAt ¶

func (x *Record) GetModifiedAt() *timestamppb.Timestamp

func (*Record) GetType ¶

func (x *Record) GetType() string

func (*Record) GetVersion ¶

func (x *Record) GetVersion() uint64

func (*Record) ProtoMessage ¶

func (*Record) ProtoMessage()

func (*Record) ProtoReflect ¶

func (x *Record) ProtoReflect() protoreflect.Message

func (*Record) Reset ¶

func (x *Record) Reset()

func (*Record) String ¶

func (x *Record) String() string

type ReleaseLeaseRequest ¶ added in v0.15.0

type ReleaseLeaseRequest struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Id   string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*ReleaseLeaseRequest) Descriptor deprecated added in v0.15.0

func (*ReleaseLeaseRequest) Descriptor() ([]byte, []int)

Deprecated: Use ReleaseLeaseRequest.ProtoReflect.Descriptor instead.

func (*ReleaseLeaseRequest) GetId ¶ added in v0.15.0

func (x *ReleaseLeaseRequest) GetId() string

func (*ReleaseLeaseRequest) GetName ¶ added in v0.15.0

func (x *ReleaseLeaseRequest) GetName() string

func (*ReleaseLeaseRequest) ProtoMessage ¶ added in v0.15.0

func (*ReleaseLeaseRequest) ProtoMessage()

func (*ReleaseLeaseRequest) ProtoReflect ¶ added in v0.15.0

func (x *ReleaseLeaseRequest) ProtoReflect() protoreflect.Message

func (*ReleaseLeaseRequest) Reset ¶ added in v0.15.0

func (x *ReleaseLeaseRequest) Reset()

func (*ReleaseLeaseRequest) String ¶ added in v0.15.0

func (x *ReleaseLeaseRequest) String() string

type RenewLeaseRequest ¶ added in v0.15.0

type RenewLeaseRequest struct {
	Name     string               `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Id       string               `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	Duration *durationpb.Duration `protobuf:"bytes,3,opt,name=duration,proto3" json:"duration,omitempty"`
	// contains filtered or unexported fields
}

func (*RenewLeaseRequest) Descriptor deprecated added in v0.15.0

func (*RenewLeaseRequest) Descriptor() ([]byte, []int)

Deprecated: Use RenewLeaseRequest.ProtoReflect.Descriptor instead.

func (*RenewLeaseRequest) GetDuration ¶ added in v0.15.0

func (x *RenewLeaseRequest) GetDuration() *durationpb.Duration

func (*RenewLeaseRequest) GetId ¶ added in v0.15.0

func (x *RenewLeaseRequest) GetId() string

func (*RenewLeaseRequest) GetName ¶ added in v0.15.0

func (x *RenewLeaseRequest) GetName() string

func (*RenewLeaseRequest) ProtoMessage ¶ added in v0.15.0

func (*RenewLeaseRequest) ProtoMessage()

func (*RenewLeaseRequest) ProtoReflect ¶ added in v0.15.0

func (x *RenewLeaseRequest) ProtoReflect() protoreflect.Message

func (*RenewLeaseRequest) Reset ¶ added in v0.15.0

func (x *RenewLeaseRequest) Reset()

func (*RenewLeaseRequest) String ¶ added in v0.15.0

func (x *RenewLeaseRequest) String() string

type SetOptionsRequest ¶ added in v0.14.0

type SetOptionsRequest struct {
	Type    string   `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	Options *Options `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"`
	// contains filtered or unexported fields
}

func (*SetOptionsRequest) Descriptor deprecated added in v0.14.0

func (*SetOptionsRequest) Descriptor() ([]byte, []int)

Deprecated: Use SetOptionsRequest.ProtoReflect.Descriptor instead.

func (*SetOptionsRequest) GetOptions ¶ added in v0.14.0

func (x *SetOptionsRequest) GetOptions() *Options

func (*SetOptionsRequest) GetType ¶ added in v0.14.0

func (x *SetOptionsRequest) GetType() string

func (*SetOptionsRequest) ProtoMessage ¶ added in v0.14.0

func (*SetOptionsRequest) ProtoMessage()

func (*SetOptionsRequest) ProtoReflect ¶ added in v0.14.0

func (x *SetOptionsRequest) ProtoReflect() protoreflect.Message

func (*SetOptionsRequest) Reset ¶ added in v0.14.0

func (x *SetOptionsRequest) Reset()

func (*SetOptionsRequest) String ¶ added in v0.14.0

func (x *SetOptionsRequest) String() string

type SetOptionsResponse ¶ added in v0.14.0

type SetOptionsResponse struct {
	Options *Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"`
	// contains filtered or unexported fields
}

func (*SetOptionsResponse) Descriptor deprecated added in v0.14.0

func (*SetOptionsResponse) Descriptor() ([]byte, []int)

Deprecated: Use SetOptionsResponse.ProtoReflect.Descriptor instead.

func (*SetOptionsResponse) GetOptions ¶ added in v0.14.0

func (x *SetOptionsResponse) GetOptions() *Options

func (*SetOptionsResponse) ProtoMessage ¶ added in v0.14.0

func (*SetOptionsResponse) ProtoMessage()

func (*SetOptionsResponse) ProtoReflect ¶ added in v0.14.0

func (x *SetOptionsResponse) ProtoReflect() protoreflect.Message

func (*SetOptionsResponse) Reset ¶ added in v0.14.0

func (x *SetOptionsResponse) Reset()

func (*SetOptionsResponse) String ¶ added in v0.14.0

func (x *SetOptionsResponse) String() string

type SyncLatestRequest ¶ added in v0.14.0

type SyncLatestRequest struct {
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	// contains filtered or unexported fields
}

func (*SyncLatestRequest) Descriptor deprecated added in v0.14.0

func (*SyncLatestRequest) Descriptor() ([]byte, []int)

Deprecated: Use SyncLatestRequest.ProtoReflect.Descriptor instead.

func (*SyncLatestRequest) GetType ¶ added in v0.14.0

func (x *SyncLatestRequest) GetType() string

func (*SyncLatestRequest) ProtoMessage ¶ added in v0.14.0

func (*SyncLatestRequest) ProtoMessage()

func (*SyncLatestRequest) ProtoReflect ¶ added in v0.14.0

func (x *SyncLatestRequest) ProtoReflect() protoreflect.Message

func (*SyncLatestRequest) Reset ¶ added in v0.14.0

func (x *SyncLatestRequest) Reset()

func (*SyncLatestRequest) String ¶ added in v0.14.0

func (x *SyncLatestRequest) String() string

type SyncLatestResponse ¶ added in v0.14.0

type SyncLatestResponse struct {

	// Types that are assignable to Response:
	//	*SyncLatestResponse_Record
	//	*SyncLatestResponse_Versions
	Response isSyncLatestResponse_Response `protobuf_oneof:"response"`
	// contains filtered or unexported fields
}

func (*SyncLatestResponse) Descriptor deprecated added in v0.14.0

func (*SyncLatestResponse) Descriptor() ([]byte, []int)

Deprecated: Use SyncLatestResponse.ProtoReflect.Descriptor instead.

func (*SyncLatestResponse) GetRecord ¶ added in v0.14.0

func (x *SyncLatestResponse) GetRecord() *Record

func (*SyncLatestResponse) GetResponse ¶ added in v0.14.0

func (m *SyncLatestResponse) GetResponse() isSyncLatestResponse_Response

func (*SyncLatestResponse) GetVersions ¶ added in v0.14.0

func (x *SyncLatestResponse) GetVersions() *Versions

func (*SyncLatestResponse) ProtoMessage ¶ added in v0.14.0

func (*SyncLatestResponse) ProtoMessage()

func (*SyncLatestResponse) ProtoReflect ¶ added in v0.14.0

func (x *SyncLatestResponse) ProtoReflect() protoreflect.Message

func (*SyncLatestResponse) Reset ¶ added in v0.14.0

func (x *SyncLatestResponse) Reset()

func (*SyncLatestResponse) String ¶ added in v0.14.0

func (x *SyncLatestResponse) String() string

type SyncLatestResponse_Record ¶ added in v0.14.0

type SyncLatestResponse_Record struct {
	Record *Record `protobuf:"bytes,1,opt,name=record,proto3,oneof"`
}

type SyncLatestResponse_Versions ¶ added in v0.14.0

type SyncLatestResponse_Versions struct {
	Versions *Versions `protobuf:"bytes,2,opt,name=versions,proto3,oneof"`
}

type SyncRequest ¶

type SyncRequest struct {
	ServerVersion uint64 `protobuf:"varint,1,opt,name=server_version,json=serverVersion,proto3" json:"server_version,omitempty"`
	RecordVersion uint64 `protobuf:"varint,2,opt,name=record_version,json=recordVersion,proto3" json:"record_version,omitempty"`
	Type          string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
	// contains filtered or unexported fields
}

func (*SyncRequest) Descriptor deprecated

func (*SyncRequest) Descriptor() ([]byte, []int)

Deprecated: Use SyncRequest.ProtoReflect.Descriptor instead.

func (*SyncRequest) GetRecordVersion ¶

func (x *SyncRequest) GetRecordVersion() uint64

func (*SyncRequest) GetServerVersion ¶

func (x *SyncRequest) GetServerVersion() uint64

func (*SyncRequest) GetType ¶

func (x *SyncRequest) GetType() string

func (*SyncRequest) ProtoMessage ¶

func (*SyncRequest) ProtoMessage()

func (*SyncRequest) ProtoReflect ¶

func (x *SyncRequest) ProtoReflect() protoreflect.Message

func (*SyncRequest) Reset ¶

func (x *SyncRequest) Reset()

func (*SyncRequest) String ¶

func (x *SyncRequest) String() string

type SyncResponse ¶

type SyncResponse struct {
	Record *Record `protobuf:"bytes,1,opt,name=record,proto3" json:"record,omitempty"`
	// contains filtered or unexported fields
}

func (*SyncResponse) Descriptor deprecated

func (*SyncResponse) Descriptor() ([]byte, []int)

Deprecated: Use SyncResponse.ProtoReflect.Descriptor instead.

func (*SyncResponse) GetRecord ¶ added in v0.14.0

func (x *SyncResponse) GetRecord() *Record

func (*SyncResponse) ProtoMessage ¶

func (*SyncResponse) ProtoMessage()

func (*SyncResponse) ProtoReflect ¶

func (x *SyncResponse) ProtoReflect() protoreflect.Message

func (*SyncResponse) Reset ¶

func (x *SyncResponse) Reset()

func (*SyncResponse) String ¶

func (x *SyncResponse) String() string

type Syncer ¶ added in v0.14.0

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

A Syncer is a helper type for working with Sync and SyncLatest. It will make a call to SyncLatest to retrieve the latest version of the data, then begin syncing with a call to Sync. If the server version changes `ClearRecords` will be called and the process will start over.

func NewSyncer ¶ added in v0.14.0

func NewSyncer(id string, handler SyncerHandler, options ...SyncerOption) *Syncer

NewSyncer creates a new Syncer.

func (*Syncer) Close ¶ added in v0.14.0

func (syncer *Syncer) Close() error

Close closes the Syncer.

func (*Syncer) Run ¶ added in v0.14.0

func (syncer *Syncer) Run(ctx context.Context) error

Run runs the Syncer.

type SyncerHandler ¶ added in v0.14.0

type SyncerHandler interface {
	GetDataBrokerServiceClient() DataBrokerServiceClient
	ClearRecords(ctx context.Context)
	UpdateRecords(ctx context.Context, serverVersion uint64, records []*Record)
}

A SyncerHandler receives sync events from the Syncer.

type SyncerOption ¶ added in v0.14.0

type SyncerOption func(cfg *syncerConfig)

A SyncerOption customizes the syncer configuration.

func WithFastForward ¶ added in v0.15.5

func WithFastForward() SyncerOption

WithFastForward in case updates are coming faster then Update can process them, will skip older records to maintain an update rate. Use for entries that represent a full state snapshot i.e. Config

func WithTypeURL ¶ added in v0.14.0

func WithTypeURL(typeURL string) SyncerOption

WithTypeURL restricts the sync'd results to the given type.

type UnimplementedDataBrokerServiceServer ¶

type UnimplementedDataBrokerServiceServer struct {
}

UnimplementedDataBrokerServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedDataBrokerServiceServer) AcquireLease ¶ added in v0.15.0

func (*UnimplementedDataBrokerServiceServer) Get ¶

func (*UnimplementedDataBrokerServiceServer) Put ¶ added in v0.14.0

func (*UnimplementedDataBrokerServiceServer) Query ¶ added in v0.11.0

func (*UnimplementedDataBrokerServiceServer) ReleaseLease ¶ added in v0.15.0

func (*UnimplementedDataBrokerServiceServer) RenewLease ¶ added in v0.15.0

func (*UnimplementedDataBrokerServiceServer) SetOptions ¶ added in v0.14.0

func (*UnimplementedDataBrokerServiceServer) Sync ¶

func (*UnimplementedDataBrokerServiceServer) SyncLatest ¶ added in v0.14.0

type Versions ¶ added in v0.14.0

type Versions struct {

	// the server version indicates the version of the server storing the data
	ServerVersion       uint64 `protobuf:"varint,1,opt,name=server_version,json=serverVersion,proto3" json:"server_version,omitempty"`
	LatestRecordVersion uint64 `protobuf:"varint,2,opt,name=latest_record_version,json=latestRecordVersion,proto3" json:"latest_record_version,omitempty"`
	// contains filtered or unexported fields
}

func (*Versions) Descriptor deprecated added in v0.14.0

func (*Versions) Descriptor() ([]byte, []int)

Deprecated: Use Versions.ProtoReflect.Descriptor instead.

func (*Versions) GetLatestRecordVersion ¶ added in v0.14.0

func (x *Versions) GetLatestRecordVersion() uint64

func (*Versions) GetServerVersion ¶ added in v0.14.0

func (x *Versions) GetServerVersion() uint64

func (*Versions) ProtoMessage ¶ added in v0.14.0

func (*Versions) ProtoMessage()

func (*Versions) ProtoReflect ¶ added in v0.14.0

func (x *Versions) ProtoReflect() protoreflect.Message

func (*Versions) Reset ¶ added in v0.14.0

func (x *Versions) Reset()

func (*Versions) String ¶ added in v0.14.0

func (x *Versions) String() string

Directories ¶

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

Jump to

Keyboard shortcuts

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