replica

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Sync_Status_name = map[int32]string{
		0: "UNKNOWN",
		1: "CHECK",
		2: "REPAIR",
		3: "COMPLETE",
		4: "ERROR",
	}
	Sync_Status_value = map[string]int32{
		"UNKNOWN":  0,
		"CHECK":    1,
		"REPAIR":   2,
		"COMPLETE": 3,
		"ERROR":    4,
	}
)

Enum value maps for Sync_Status.

View Source
var File_replica_v1_replica_proto protoreflect.FileDescriptor
View Source
var Replication_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "honu.replica.v1.Replication",
	HandlerType: (*ReplicationServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Gossip",
			Handler:       _Replication_Gossip_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "replica/v1/replica.proto",
}

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

Functions

func RegisterReplicationServer

func RegisterReplicationServer(s grpc.ServiceRegistrar, srv ReplicationServer)

Types

type ReplicationClient

type ReplicationClient interface {
	// Gossip implements biltateral anti-entropy: during a Gossip session the initiating
	// replica pushes updates to the remote peer and pulls requested changes. Using
	// bidirectional streaming, the initiating peer sends data-less sync messages with
	// the versions of objects it stores locally. The remote replica then responds with
	// data if its local version is later or sends a sync message back requesting the
	// data from the initating replica if its local version is earlier (no exchange)
	// occurs if both replicas have the same version. At the end of a gossip session,
	// both replicas should have synchronized and have identical underlying data stores.
	Gossip(ctx context.Context, opts ...grpc.CallOption) (Replication_GossipClient, error)
}

ReplicationClient is the client API for Replication 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.

type ReplicationServer

type ReplicationServer interface {
	// Gossip implements biltateral anti-entropy: during a Gossip session the initiating
	// replica pushes updates to the remote peer and pulls requested changes. Using
	// bidirectional streaming, the initiating peer sends data-less sync messages with
	// the versions of objects it stores locally. The remote replica then responds with
	// data if its local version is later or sends a sync message back requesting the
	// data from the initating replica if its local version is earlier (no exchange)
	// occurs if both replicas have the same version. At the end of a gossip session,
	// both replicas should have synchronized and have identical underlying data stores.
	Gossip(Replication_GossipServer) error
	// contains filtered or unexported methods
}

ReplicationServer is the server API for Replication service. All implementations must embed UnimplementedReplicationServer for forward compatibility

type Replication_GossipClient added in v0.2.6

type Replication_GossipClient interface {
	Send(*Sync) error
	Recv() (*Sync, error)
	grpc.ClientStream
}

type Replication_GossipServer added in v0.2.6

type Replication_GossipServer interface {
	Send(*Sync) error
	Recv() (*Sync, error)
	grpc.ServerStream
}

type Sync added in v0.2.6

type Sync struct {
	Status Sync_Status    `protobuf:"varint,1,opt,name=status,proto3,enum=honu.replica.v1.Sync_Status" json:"status,omitempty"` // The status/type of sync messages
	Object *object.Object `protobuf:"bytes,2,opt,name=object,proto3" json:"object,omitempty"`                                   // The object being synchronized
	Error  string         `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"`                                     // Error information if the object failed to sync
	// contains filtered or unexported fields
}

Sync messages allow replicas to exchange information in a bidirectional stream. Because Sync messages are sent in the stream, there are different synchronization types. A "check" synchronization sends only the version vector without data, requesting the remote peer to check if they have a later version, and if so, return it. A "repair" synchronization sends object data back if the sender's version is later. A "complete" synchronization indicates that the sender is fully synchronized, and an "error" synchronization message says that there was some failure repairing the specified version vector.

func (*Sync) Descriptor deprecated added in v0.2.6

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

Deprecated: Use Sync.ProtoReflect.Descriptor instead.

func (*Sync) GetError added in v0.2.6

func (x *Sync) GetError() string

func (*Sync) GetObject added in v0.2.6

func (x *Sync) GetObject() *object.Object

func (*Sync) GetStatus added in v0.2.6

func (x *Sync) GetStatus() Sync_Status

func (*Sync) ProtoMessage added in v0.2.6

func (*Sync) ProtoMessage()

func (*Sync) ProtoReflect added in v0.2.6

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

func (*Sync) Reset added in v0.2.6

func (x *Sync) Reset()

func (*Sync) String added in v0.2.6

func (x *Sync) String() string

type Sync_Status added in v0.2.6

type Sync_Status int32

Status indicates what state the synchronization is in between peers, allowing the replicas to coordinate between multiple sync messages in a grpc stream.

const (
	Sync_UNKNOWN  Sync_Status = 0 // Should not be used as a status
	Sync_CHECK    Sync_Status = 1 // Sync contains version information only
	Sync_REPAIR   Sync_Status = 2 // Sync contains object data information
	Sync_COMPLETE Sync_Status = 3 // Sync contains no object information, ready to end Gossip
	Sync_ERROR    Sync_Status = 4 // Sync contains object-specific error information
)

func (Sync_Status) Descriptor added in v0.2.6

func (Sync_Status) Enum added in v0.2.6

func (x Sync_Status) Enum() *Sync_Status

func (Sync_Status) EnumDescriptor deprecated added in v0.2.6

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

Deprecated: Use Sync_Status.Descriptor instead.

func (Sync_Status) Number added in v0.2.6

func (x Sync_Status) Number() protoreflect.EnumNumber

func (Sync_Status) String added in v0.2.6

func (x Sync_Status) String() string

func (Sync_Status) Type added in v0.2.6

type UnimplementedReplicationServer

type UnimplementedReplicationServer struct {
}

UnimplementedReplicationServer must be embedded to have forward compatible implementations.

func (UnimplementedReplicationServer) Gossip

type UnsafeReplicationServer

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

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

Jump to

Keyboard shortcuts

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