api

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const API_VERSION uint32 = 1

Variables

View Source
var (
	Error_name = map[int32]string{
		0: "SERVER_ERROR",
		1: "MALFORMED_RECORD",
	}
	Error_value = map[string]int32{
		"SERVER_ERROR":     0,
		"MALFORMED_RECORD": 1,
	}
)

Enum value maps for Error.

View Source
var (
	DataType_name = map[int32]string{
		0:  "UINT",
		1:  "INT",
		2:  "FLOAT",
		3:  "BOOL",
		4:  "STRING",
		5:  "BYTES",
		16: "RECORD",
	}
	DataType_value = map[string]int32{
		"UINT":   0,
		"INT":    1,
		"FLOAT":  2,
		"BOOL":   3,
		"STRING": 4,
		"BYTES":  5,
		"RECORD": 16,
	}
)

Enum value maps for DataType.

View Source
var File_api_syncd_proto protoreflect.FileDescriptor
View Source
var Sync_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "syncd.Sync",
	HandlerType: (*SyncServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Check",
			Handler:    _Sync_Check_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Push",
			Handler:       _Sync_Push_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
		{
			StreamName:    "Pull",
			Handler:       _Sync_Pull_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "Acknowledge",
			Handler:       _Sync_Acknowledge_Handler,
			ClientStreams: true,
		},
	},
	Metadata: "api/syncd.proto",
}

Sync_ServiceDesc is the grpc.ServiceDesc for Sync service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func LocalRecordError

func LocalRecordError() *uint32

func NoRecordError

func NoRecordError() *uint32

func RegisterSyncServer

func RegisterSyncServer(s grpc.ServiceRegistrar, srv SyncServer)

Types

type AcknowledgeResponse

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

func (*AcknowledgeResponse) Descriptor deprecated

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

Deprecated: Use AcknowledgeResponse.ProtoReflect.Descriptor instead.

func (*AcknowledgeResponse) ProtoMessage

func (*AcknowledgeResponse) ProtoMessage()

func (*AcknowledgeResponse) ProtoReflect

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

func (*AcknowledgeResponse) Reset

func (x *AcknowledgeResponse) Reset()

func (*AcknowledgeResponse) String

func (x *AcknowledgeResponse) String() string

type Data

type Data struct {
	Type    DataType  `protobuf:"varint,1,opt,name=type,proto3,enum=syncd.DataType" json:"type,omitempty"`
	IsList  bool      `protobuf:"varint,2,opt,name=is_list,json=isList,proto3" json:"is_list,omitempty"`
	Uints   []uint64  `protobuf:"varint,3,rep,packed,name=uints,proto3" json:"uints,omitempty"`
	Ints    []int64   `protobuf:"zigzag64,4,rep,packed,name=ints,proto3" json:"ints,omitempty"`
	Floats  []float64 `protobuf:"fixed64,5,rep,packed,name=floats,proto3" json:"floats,omitempty"`
	Bools   []bool    `protobuf:"varint,6,rep,packed,name=bools,proto3" json:"bools,omitempty"`
	Strings []string  `protobuf:"bytes,7,rep,name=strings,proto3" json:"strings,omitempty"`
	Bytes   [][]byte  `protobuf:"bytes,8,rep,name=bytes,proto3" json:"bytes,omitempty"`
	Records []*Record `protobuf:"bytes,15,rep,name=records,proto3" json:"records,omitempty"`
	// contains filtered or unexported fields
}

func (*Data) Describe

func (d *Data) Describe() string

func (*Data) Descriptor deprecated

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

Deprecated: Use Data.ProtoReflect.Descriptor instead.

func (*Data) GetBools

func (x *Data) GetBools() []bool

func (*Data) GetBytes

func (x *Data) GetBytes() [][]byte

func (*Data) GetFloats

func (x *Data) GetFloats() []float64

func (*Data) GetInts

func (x *Data) GetInts() []int64

func (*Data) GetIsList

func (x *Data) GetIsList() bool

func (*Data) GetRecords

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

func (*Data) GetStrings

func (x *Data) GetStrings() []string

func (*Data) GetType

func (x *Data) GetType() DataType

func (*Data) GetUints

func (x *Data) GetUints() []uint64

func (*Data) ProtoMessage

func (*Data) ProtoMessage()

func (*Data) ProtoReflect

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

func (*Data) Reset

func (x *Data) Reset()

func (*Data) String

func (x *Data) String() string

type DataType

type DataType int32
const (
	DataType_UINT   DataType = 0 // encoded as uint64
	DataType_INT    DataType = 1 // encoded as sint64
	DataType_FLOAT  DataType = 2 // encoded as double
	DataType_BOOL   DataType = 3 // encoded as bool
	DataType_STRING DataType = 4 // encoded as string
	DataType_BYTES  DataType = 5 // encoded as bytes
	DataType_RECORD DataType = 16
)

func (DataType) Descriptor

func (DataType) Descriptor() protoreflect.EnumDescriptor

func (DataType) Enum

func (x DataType) Enum() *DataType

func (DataType) EnumDescriptor deprecated

func (DataType) EnumDescriptor() ([]byte, []int)

Deprecated: Use DataType.Descriptor instead.

func (DataType) Number

func (x DataType) Number() protoreflect.EnumNumber

func (DataType) String

func (x DataType) String() string

func (DataType) Type

type Error

type Error int32
const (
	Error_SERVER_ERROR     Error = 0
	Error_MALFORMED_RECORD Error = 1
)

func (Error) Descriptor

func (Error) Descriptor() protoreflect.EnumDescriptor

func (Error) Enum

func (x Error) Enum() *Error

func (Error) EnumDescriptor deprecated

func (Error) EnumDescriptor() ([]byte, []int)

Deprecated: Use Error.Descriptor instead.

func (Error) Number

func (x Error) Number() protoreflect.EnumNumber

func (Error) String

func (x Error) String() string

func (Error) Type

func (Error) Type() protoreflect.EnumType

type IDataType

type IDataType interface {
	New() *Data
	NewList() *Data
	NewValue() interface{}
	Type() DataType
	Append(value interface{}, data *Data) error
	MustAppend(value interface{}, data *Data)
	Encode(value interface{}, data *Data) error
	MustEncode(value interface{}, data *Data)
	Decode(data *Data, value interface{}) error
	MustDecode(data *Data, value interface{})
}

type Info

type Info struct {
	ApiVersion uint32 `protobuf:"varint,1,opt,name=api_version,json=apiVersion,proto3" json:"api_version,omitempty"`
	// contains filtered or unexported fields
}

func CheckInfo

func CheckInfo() *Info

func (*Info) Descriptor deprecated

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

Deprecated: Use Info.ProtoReflect.Descriptor instead.

func (*Info) GetApiVersion

func (x *Info) GetApiVersion() uint32

func (*Info) ProtoMessage

func (*Info) ProtoMessage()

func (*Info) ProtoReflect

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

func (*Info) Reset

func (x *Info) Reset()

func (*Info) String

func (x *Info) String() string

type IntData

type IntData struct{}

func (IntData) Append

func (IntData) Append(value interface{}, data *Data) error

func (IntData) Decode

func (IntData) Decode(data *Data, value interface{}) error

func (IntData) Encode

func (IntData) Encode(value interface{}, data *Data) (err error)

func (IntData) From

func (s IntData) From(i int64) *Data

func (IntData) FromAll

func (s IntData) FromAll(i ...int64) *Data

func (IntData) MustAppend

func (s IntData) MustAppend(value interface{}, data *Data)

func (IntData) MustDecode

func (s IntData) MustDecode(data *Data, value interface{})

func (IntData) MustEncode

func (s IntData) MustEncode(value interface{}, data *Data)

func (IntData) New

func (IntData) New() *Data

func (IntData) NewList

func (s IntData) NewList() *Data

func (IntData) NewValue

func (IntData) NewValue() interface{}

func (IntData) Type

func (IntData) Type() DataType

type Metadata

type Metadata struct {
	Peer  string
	Model string
	// contains filtered or unexported fields
}

func GetMetadataFromContext

func GetMetadataFromContext(ctx context.Context) (md Metadata, ok bool)

func MustGetMetadataFromContext

func MustGetMetadataFromContext(ctx context.Context) Metadata

func (*Metadata) MetricLabels

func (md *Metadata) MetricLabels() prometheus.Labels

type PullRequest

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

func (*PullRequest) Descriptor deprecated

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

Deprecated: Use PullRequest.ProtoReflect.Descriptor instead.

func (*PullRequest) ProtoMessage

func (*PullRequest) ProtoMessage()

func (*PullRequest) ProtoReflect

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

func (*PullRequest) Reset

func (x *PullRequest) Reset()

func (*PullRequest) String

func (x *PullRequest) String() string

type Record

type Record struct {
	Fields map[string]*Data `` /* 153-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Record) Descriptor deprecated

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

Deprecated: Use Record.ProtoReflect.Descriptor instead.

func (*Record) GetFields

func (x *Record) GetFields() map[string]*Data

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 RecordStatus

type RecordStatus struct {
	Id         string            `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Version    string            `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	Error      *uint32           `protobuf:"varint,3,opt,name=error,proto3,oneof" json:"error,omitempty"`
	ErrorField *string           `protobuf:"bytes,4,opt,name=error_field,json=errorField,proto3,oneof" json:"error_field,omitempty"`
	Sequences  map[string]uint64 `` /* 160-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*RecordStatus) Descriptor deprecated

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

Deprecated: Use RecordStatus.ProtoReflect.Descriptor instead.

func (*RecordStatus) GetError

func (x *RecordStatus) GetError() uint32

func (*RecordStatus) GetErrorField

func (x *RecordStatus) GetErrorField() string

func (*RecordStatus) GetId

func (x *RecordStatus) GetId() string

func (*RecordStatus) GetSequences

func (x *RecordStatus) GetSequences() map[string]uint64

func (*RecordStatus) GetVersion

func (x *RecordStatus) GetVersion() string

func (*RecordStatus) ProtoMessage

func (*RecordStatus) ProtoMessage()

func (*RecordStatus) ProtoReflect

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

func (*RecordStatus) Reset

func (x *RecordStatus) Reset()

func (*RecordStatus) String

func (x *RecordStatus) String() string

type StringData

type StringData struct{}

func (StringData) Append

func (StringData) Append(value interface{}, data *Data) error

func (StringData) Decode

func (StringData) Decode(data *Data, value interface{}) error

func (StringData) Encode

func (StringData) Encode(value interface{}, data *Data) (err error)

func (StringData) From

func (s StringData) From(str string) *Data

func (StringData) FromAll

func (s StringData) FromAll(str ...string) *Data

func (StringData) MustAppend

func (s StringData) MustAppend(value interface{}, data *Data)

func (StringData) MustDecode

func (s StringData) MustDecode(data *Data, value interface{})

func (StringData) MustEncode

func (s StringData) MustEncode(value interface{}, data *Data)

func (StringData) New

func (StringData) New() *Data

func (StringData) NewList

func (s StringData) NewList() *Data

func (StringData) NewValue

func (StringData) NewValue() interface{}

func (StringData) Type

func (StringData) Type() DataType

type SyncClient

type SyncClient interface {
	Check(ctx context.Context, in *Info, opts ...grpc.CallOption) (*Info, error)
	Push(ctx context.Context, opts ...grpc.CallOption) (Sync_PushClient, error)
	Pull(ctx context.Context, in *PullRequest, opts ...grpc.CallOption) (Sync_PullClient, error)
	Acknowledge(ctx context.Context, opts ...grpc.CallOption) (Sync_AcknowledgeClient, error)
}

SyncClient is the client API for Sync service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewSyncClient

func NewSyncClient(cc grpc.ClientConnInterface) SyncClient

type SyncServer

type SyncServer interface {
	Check(context.Context, *Info) (*Info, error)
	Push(Sync_PushServer) error
	Pull(*PullRequest, Sync_PullServer) error
	Acknowledge(Sync_AcknowledgeServer) error
	// contains filtered or unexported methods
}

SyncServer is the server API for Sync service. All implementations must embed UnimplementedSyncServer for forward compatibility

type Sync_AcknowledgeClient

type Sync_AcknowledgeClient interface {
	Send(*RecordStatus) error
	CloseAndRecv() (*AcknowledgeResponse, error)
	grpc.ClientStream
}

type Sync_AcknowledgeServer

type Sync_AcknowledgeServer interface {
	SendAndClose(*AcknowledgeResponse) error
	Recv() (*RecordStatus, error)
	grpc.ServerStream
}

type Sync_PullClient

type Sync_PullClient interface {
	Recv() (*Record, error)
	grpc.ClientStream
}

type Sync_PullServer

type Sync_PullServer interface {
	Send(*Record) error
	grpc.ServerStream
}

type Sync_PushClient

type Sync_PushClient interface {
	Send(*Record) error
	Recv() (*RecordStatus, error)
	grpc.ClientStream
}

type Sync_PushServer

type Sync_PushServer interface {
	Send(*RecordStatus) error
	Recv() (*Record, error)
	grpc.ServerStream
}

type UintData

type UintData struct{}

func (UintData) Append

func (UintData) Append(value interface{}, data *Data) error

func (UintData) Decode

func (UintData) Decode(data *Data, value interface{}) error

func (UintData) Encode

func (UintData) Encode(value interface{}, data *Data) (err error)

func (UintData) From

func (s UintData) From(i uint64) *Data

func (UintData) FromAll

func (s UintData) FromAll(i ...uint64) *Data

func (UintData) MustAppend

func (s UintData) MustAppend(value interface{}, data *Data)

func (UintData) MustDecode

func (s UintData) MustDecode(data *Data, value interface{})

func (UintData) MustEncode

func (s UintData) MustEncode(value interface{}, data *Data)

func (UintData) New

func (UintData) New() *Data

func (UintData) NewList

func (s UintData) NewList() *Data

func (UintData) NewValue

func (UintData) NewValue() interface{}

func (UintData) Type

func (UintData) Type() DataType

type UnimplementedSyncServer

type UnimplementedSyncServer struct {
}

UnimplementedSyncServer must be embedded to have forward compatible implementations.

func (UnimplementedSyncServer) Acknowledge

func (UnimplementedSyncServer) Check

func (UnimplementedSyncServer) Pull

func (UnimplementedSyncServer) Push

type UnsafeSyncServer

type UnsafeSyncServer interface {
	// contains filtered or unexported methods
}

UnsafeSyncServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to SyncServer will result in compilation errors.

Jump to

Keyboard shortcuts

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