feature/pubsub #7
@@ -792,7 +792,18 @@ func (s *PoolServer) Serve(mux *http.ServeMux) {
|
||||
http.Error(w, "Invalid HMAC", http.StatusUnauthorized)
|
||||
return
|
||||
} else {
|
||||
|
||||
cartId, ok := cart.ParseCartId(notification.OriginalReference)
|
||||
log.Printf("Recieved notification event code: %s, %v", notification.EventCode, notification)
|
||||
if ok {
|
||||
host, ok := s.OwnerHost(uint64(cartId))
|
||||
if ok {
|
||||
log.Printf("Not owner of %d, owner: %s", cartId, host.Name())
|
||||
//host.Apply(r.Context(), cartId)
|
||||
} else {
|
||||
log.Printf("I'm the owner of %d", cartId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
|
||||
@@ -35,6 +35,7 @@ type Host interface {
|
||||
Negotiate(otherHosts []string) ([]string, error)
|
||||
Name() string
|
||||
Proxy(id uint64, w http.ResponseWriter, r *http.Request) (bool, error)
|
||||
Apply(ctx context.Context, id uint64, mutation ...proto.Message) (bool, error)
|
||||
GetActorIds() []uint64
|
||||
Close() error
|
||||
Ping() bool
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"time"
|
||||
|
||||
messages "git.k6n.net/go-cart-actor/pkg/messages"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"go.opentelemetry.io/contrib/bridges/otelslog"
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
@@ -139,6 +140,69 @@ func (s *ControlServer[V]) Ping(ctx context.Context, _ *messages.Empty) (*messag
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *ControlServer[V]) Apply(ctx context.Context, in *messages.ApplyRequest) (*messages.ApplyResult, error) {
|
||||
msgs := make([]proto.Message, len(in.Messages))
|
||||
for i, mut := range in.Messages {
|
||||
var msg proto.Message
|
||||
if m := mut.GetClearCart(); m != nil {
|
||||
msg = m
|
||||
} else if m := mut.GetAddItem(); m != nil {
|
||||
msg = m
|
||||
} else if m := mut.GetRemoveItem(); m != nil {
|
||||
msg = m
|
||||
} else if m := mut.GetChangeQuantity(); m != nil {
|
||||
msg = m
|
||||
} else if m := mut.GetSetDelivery(); m != nil {
|
||||
msg = m
|
||||
} else if m := mut.GetSetPickupPoint(); m != nil {
|
||||
msg = m
|
||||
} else if m := mut.GetRemoveDelivery(); m != nil {
|
||||
msg = m
|
||||
} else if m := mut.GetSetUserId(); m != nil {
|
||||
msg = m
|
||||
} else if m := mut.GetLineItemMarking(); m != nil {
|
||||
msg = m
|
||||
} else if m := mut.GetRemoveLineItemMarking(); m != nil {
|
||||
msg = m
|
||||
} else if m := mut.GetSubscriptionAdded(); m != nil {
|
||||
msg = m
|
||||
} else if m := mut.GetPaymentDeclined(); m != nil {
|
||||
msg = m
|
||||
} else if m := mut.GetConfirmationViewed(); m != nil {
|
||||
msg = m
|
||||
} else if m := mut.GetCreateCheckoutOrder(); m != nil {
|
||||
msg = m
|
||||
} else if m := mut.GetOrderCreated(); m != nil {
|
||||
msg = m
|
||||
} else if m := mut.GetNoop(); m != nil {
|
||||
msg = m
|
||||
} else if m := mut.GetInitializeCheckout(); m != nil {
|
||||
msg = m
|
||||
} else if m := mut.GetInventoryReserved(); m != nil {
|
||||
msg = m
|
||||
} else if m := mut.GetAddVoucher(); m != nil {
|
||||
msg = m
|
||||
} else if m := mut.GetRemoveVoucher(); m != nil {
|
||||
msg = m
|
||||
} else if m := mut.GetUpsertSubscriptionDetails(); m != nil {
|
||||
msg = m
|
||||
} else if m := mut.GetPreConditionFailed(); m != nil {
|
||||
msg = m
|
||||
} else if m := mut.GetAddGiftcard(); m != nil {
|
||||
msg = m
|
||||
} else if m := mut.GetRemoveGiftcard(); m != nil {
|
||||
msg = m
|
||||
}
|
||||
msgs[i] = msg
|
||||
}
|
||||
_, err := s.pool.Apply(ctx, in.Id, msgs...)
|
||||
if err != nil {
|
||||
return &messages.ApplyResult{Accepted: false}, err
|
||||
}
|
||||
|
||||
return &messages.ApplyResult{Accepted: true}, nil
|
||||
}
|
||||
|
||||
// ControlPlane: Negotiate (merge host views)
|
||||
func (s *ControlServer[V]) Negotiate(ctx context.Context, req *messages.NegotiateRequest) (*messages.NegotiateReply, error) {
|
||||
ctx, span := tracer.Start(ctx, "grpc_negotiate")
|
||||
|
||||
@@ -212,9 +212,9 @@ func (r *ProtoMutationRegistry) Apply(ctx context.Context, grain any, msg ...pro
|
||||
}
|
||||
|
||||
for _, m := range msg {
|
||||
// Ignore nil mutation elements (untyped or typed nil pointers) silently; they carry no data.
|
||||
// Error if any mutation element is nil.
|
||||
if m == nil {
|
||||
continue
|
||||
return results, fmt.Errorf("nil mutation message")
|
||||
}
|
||||
// Typed nil: interface holds concrete proto message type whose pointer value is nil.
|
||||
rv := reflect.ValueOf(m)
|
||||
@@ -251,6 +251,12 @@ func (r *ProtoMutationRegistry) Apply(ctx context.Context, grain any, msg ...pro
|
||||
}
|
||||
}
|
||||
}
|
||||
// Return error for unregistered mutations
|
||||
for _, res := range results {
|
||||
if res.Error == ErrMutationNotRegistered {
|
||||
return results, res.Error
|
||||
}
|
||||
}
|
||||
return results, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package actor
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"reflect"
|
||||
"slices"
|
||||
"testing"
|
||||
@@ -90,7 +89,7 @@ func TestRegisteredMutationBasics(t *testing.T) {
|
||||
}
|
||||
|
||||
// Apply nil grain
|
||||
if _, err := reg.Apply(nil, add); err == nil {
|
||||
if _, err := reg.Apply(context.Background(), nil, add); err == nil {
|
||||
t.Fatalf("expected error for nil grain")
|
||||
}
|
||||
|
||||
@@ -100,7 +99,8 @@ func TestRegisteredMutationBasics(t *testing.T) {
|
||||
}
|
||||
|
||||
// Apply unregistered message
|
||||
if _, err := reg.Apply(context.Background(), state, &messages.Noop{}); !errors.Is(err, ErrMutationNotRegistered) {
|
||||
_, err := reg.Apply(context.Background(), state, &messages.Noop{})
|
||||
if err != ErrMutationNotRegistered {
|
||||
t.Fatalf("expected ErrMutationNotRegistered, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,10 +267,10 @@ func TestMutationRegistryCoverage(t *testing.T) {
|
||||
t.Fatalf("GetTypeName failed for AddItem, got (%q,%v)", nm, ok)
|
||||
}
|
||||
|
||||
// Apply unregistered message -> result should contain ErrMutationNotRegistered, no top-level error
|
||||
// Apply unregistered message -> should return error
|
||||
results, err := reg.Apply(context.Background(), newTestGrain(), &messages.Noop{})
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected top-level error applying unregistered mutation: %v", err)
|
||||
if err == nil {
|
||||
t.Fatalf("expected error for unregistered mutation")
|
||||
}
|
||||
if len(results) != 1 || results[0].Error == nil || results[0].Error != actor.ErrMutationNotRegistered {
|
||||
t.Fatalf("expected ApplyResult with ErrMutationNotRegistered, got %#v", results)
|
||||
|
||||
@@ -451,11 +451,108 @@ func (x *ExpiryAnnounce) GetIds() []uint64 {
|
||||
return nil
|
||||
}
|
||||
|
||||
type ApplyRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Messages []*Mutation `protobuf:"bytes,2,rep,name=messages,proto3" json:"messages,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ApplyRequest) Reset() {
|
||||
*x = ApplyRequest{}
|
||||
mi := &file_control_plane_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ApplyRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ApplyRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ApplyRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_control_plane_proto_msgTypes[9]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ApplyRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ApplyRequest) Descriptor() ([]byte, []int) {
|
||||
return file_control_plane_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
func (x *ApplyRequest) GetId() uint64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ApplyRequest) GetMessages() []*Mutation {
|
||||
if x != nil {
|
||||
return x.Messages
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ApplyResult struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Accepted bool `protobuf:"varint,1,opt,name=accepted,proto3" json:"accepted,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ApplyResult) Reset() {
|
||||
*x = ApplyResult{}
|
||||
mi := &file_control_plane_proto_msgTypes[10]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ApplyResult) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ApplyResult) ProtoMessage() {}
|
||||
|
||||
func (x *ApplyResult) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_control_plane_proto_msgTypes[10]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ApplyResult.ProtoReflect.Descriptor instead.
|
||||
func (*ApplyResult) Descriptor() ([]byte, []int) {
|
||||
return file_control_plane_proto_rawDescGZIP(), []int{10}
|
||||
}
|
||||
|
||||
func (x *ApplyResult) GetAccepted() bool {
|
||||
if x != nil {
|
||||
return x.Accepted
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var File_control_plane_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_control_plane_proto_rawDesc = string([]byte{
|
||||
0x0a, 0x13, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x22,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x1a,
|
||||
0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
|
||||
0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x3c, 0x0a, 0x09, 0x50, 0x69, 0x6e, 0x67,
|
||||
0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x6e, 0x69,
|
||||
@@ -482,35 +579,46 @@ var file_control_plane_proto_rawDesc = string([]byte{
|
||||
0x0a, 0x0e, 0x45, 0x78, 0x70, 0x69, 0x72, 0x79, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65,
|
||||
0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
|
||||
0x68, 0x6f, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28,
|
||||
0x04, 0x52, 0x03, 0x69, 0x64, 0x73, 0x32, 0x8d, 0x03, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x74, 0x72,
|
||||
0x6f, 0x6c, 0x50, 0x6c, 0x61, 0x6e, 0x65, 0x12, 0x2c, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12,
|
||||
0x0f, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79,
|
||||
0x1a, 0x13, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x50, 0x69, 0x6e, 0x67,
|
||||
0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x41, 0x0a, 0x09, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61,
|
||||
0x74, 0x65, 0x12, 0x1a, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4e, 0x65,
|
||||
0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18,
|
||||
0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69,
|
||||
0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x3c, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x4c,
|
||||
0x6f, 0x63, 0x61, 0x6c, 0x41, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x73, 0x12, 0x0f, 0x2e, 0x6d,
|
||||
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x17, 0x2e,
|
||||
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x41, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64,
|
||||
0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x4a, 0x0a, 0x11, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e,
|
||||
0x63, 0x65, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x12, 0x1b, 0x2e, 0x6d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70,
|
||||
0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x1a, 0x18, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61,
|
||||
0x67, 0x65, 0x73, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x41,
|
||||
0x63, 0x6b, 0x12, 0x44, 0x0a, 0x0e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x45, 0x78,
|
||||
0x70, 0x69, 0x72, 0x79, 0x12, 0x18, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e,
|
||||
0x45, 0x78, 0x70, 0x69, 0x72, 0x79, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x1a, 0x18,
|
||||
0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x43,
|
||||
0x68, 0x61, 0x6e, 0x67, 0x65, 0x41, 0x63, 0x6b, 0x12, 0x3c, 0x0a, 0x07, 0x43, 0x6c, 0x6f, 0x73,
|
||||
0x69, 0x6e, 0x67, 0x12, 0x17, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x43,
|
||||
0x6c, 0x6f, 0x73, 0x69, 0x6e, 0x67, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x1a, 0x18, 0x2e, 0x6d,
|
||||
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x43, 0x68, 0x61,
|
||||
0x6e, 0x67, 0x65, 0x41, 0x63, 0x6b, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x2e, 0x6b, 0x36,
|
||||
0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x61, 0x72, 0x74, 0x2d, 0x61, 0x63,
|
||||
0x74, 0x6f, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
|
||||
0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x04, 0x52, 0x03, 0x69, 0x64, 0x73, 0x22, 0x4e, 0x0a, 0x0c, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2e, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
|
||||
0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61,
|
||||
0x67, 0x65, 0x73, 0x2e, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x6d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x22, 0x29, 0x0a, 0x0b, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52,
|
||||
0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65,
|
||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65,
|
||||
0x64, 0x32, 0xc5, 0x03, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x50, 0x6c, 0x61,
|
||||
0x6e, 0x65, 0x12, 0x2c, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x0f, 0x2e, 0x6d, 0x65, 0x73,
|
||||
0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x13, 0x2e, 0x6d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x70, 0x6c, 0x79,
|
||||
0x12, 0x41, 0x0a, 0x09, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x65, 0x12, 0x1a, 0x2e,
|
||||
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61,
|
||||
0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6d, 0x65, 0x73, 0x73,
|
||||
0x61, 0x67, 0x65, 0x73, 0x2e, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65,
|
||||
0x70, 0x6c, 0x79, 0x12, 0x3c, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x41,
|
||||
0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x73, 0x12, 0x0f, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
|
||||
0x65, 0x73, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x17, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61,
|
||||
0x67, 0x65, 0x73, 0x2e, 0x41, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x73, 0x52, 0x65, 0x70, 0x6c,
|
||||
0x79, 0x12, 0x4a, 0x0a, 0x11, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x4f, 0x77, 0x6e,
|
||||
0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x12, 0x1b, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||
0x73, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x41, 0x6e, 0x6e, 0x6f, 0x75,
|
||||
0x6e, 0x63, 0x65, 0x1a, 0x18, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4f,
|
||||
0x77, 0x6e, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x41, 0x63, 0x6b, 0x12, 0x36, 0x0a,
|
||||
0x05, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x12, 0x16, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||
0x73, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15,
|
||||
0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52,
|
||||
0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x44, 0x0a, 0x0e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63,
|
||||
0x65, 0x45, 0x78, 0x70, 0x69, 0x72, 0x79, 0x12, 0x18, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
|
||||
0x65, 0x73, 0x2e, 0x45, 0x78, 0x70, 0x69, 0x72, 0x79, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63,
|
||||
0x65, 0x1a, 0x18, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4f, 0x77, 0x6e,
|
||||
0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x41, 0x63, 0x6b, 0x12, 0x3c, 0x0a, 0x07, 0x43,
|
||||
0x6c, 0x6f, 0x73, 0x69, 0x6e, 0x67, 0x12, 0x17, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||
0x73, 0x2e, 0x43, 0x6c, 0x6f, 0x73, 0x69, 0x6e, 0x67, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x1a,
|
||||
0x18, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72,
|
||||
0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x41, 0x63, 0x6b, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74,
|
||||
0x2e, 0x6b, 0x36, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x61, 0x72, 0x74,
|
||||
0x2d, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x6d, 0x65, 0x73,
|
||||
0x73, 0x61, 0x67, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
})
|
||||
|
||||
var (
|
||||
@@ -525,7 +633,7 @@ func file_control_plane_proto_rawDescGZIP() []byte {
|
||||
return file_control_plane_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_control_plane_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
|
||||
var file_control_plane_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
|
||||
var file_control_plane_proto_goTypes = []any{
|
||||
(*Empty)(nil), // 0: messages.Empty
|
||||
(*PingReply)(nil), // 1: messages.PingReply
|
||||
@@ -536,25 +644,31 @@ var file_control_plane_proto_goTypes = []any{
|
||||
(*ClosingNotice)(nil), // 6: messages.ClosingNotice
|
||||
(*OwnershipAnnounce)(nil), // 7: messages.OwnershipAnnounce
|
||||
(*ExpiryAnnounce)(nil), // 8: messages.ExpiryAnnounce
|
||||
(*ApplyRequest)(nil), // 9: messages.ApplyRequest
|
||||
(*ApplyResult)(nil), // 10: messages.ApplyResult
|
||||
(*Mutation)(nil), // 11: messages.Mutation
|
||||
}
|
||||
var file_control_plane_proto_depIdxs = []int32{
|
||||
0, // 0: messages.ControlPlane.Ping:input_type -> messages.Empty
|
||||
2, // 1: messages.ControlPlane.Negotiate:input_type -> messages.NegotiateRequest
|
||||
0, // 2: messages.ControlPlane.GetLocalActorIds:input_type -> messages.Empty
|
||||
7, // 3: messages.ControlPlane.AnnounceOwnership:input_type -> messages.OwnershipAnnounce
|
||||
8, // 4: messages.ControlPlane.AnnounceExpiry:input_type -> messages.ExpiryAnnounce
|
||||
6, // 5: messages.ControlPlane.Closing:input_type -> messages.ClosingNotice
|
||||
1, // 6: messages.ControlPlane.Ping:output_type -> messages.PingReply
|
||||
3, // 7: messages.ControlPlane.Negotiate:output_type -> messages.NegotiateReply
|
||||
4, // 8: messages.ControlPlane.GetLocalActorIds:output_type -> messages.ActorIdsReply
|
||||
5, // 9: messages.ControlPlane.AnnounceOwnership:output_type -> messages.OwnerChangeAck
|
||||
5, // 10: messages.ControlPlane.AnnounceExpiry:output_type -> messages.OwnerChangeAck
|
||||
5, // 11: messages.ControlPlane.Closing:output_type -> messages.OwnerChangeAck
|
||||
6, // [6:12] is the sub-list for method output_type
|
||||
0, // [0:6] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
11, // 0: messages.ApplyRequest.messages:type_name -> messages.Mutation
|
||||
0, // 1: messages.ControlPlane.Ping:input_type -> messages.Empty
|
||||
2, // 2: messages.ControlPlane.Negotiate:input_type -> messages.NegotiateRequest
|
||||
0, // 3: messages.ControlPlane.GetLocalActorIds:input_type -> messages.Empty
|
||||
7, // 4: messages.ControlPlane.AnnounceOwnership:input_type -> messages.OwnershipAnnounce
|
||||
9, // 5: messages.ControlPlane.Apply:input_type -> messages.ApplyRequest
|
||||
8, // 6: messages.ControlPlane.AnnounceExpiry:input_type -> messages.ExpiryAnnounce
|
||||
6, // 7: messages.ControlPlane.Closing:input_type -> messages.ClosingNotice
|
||||
1, // 8: messages.ControlPlane.Ping:output_type -> messages.PingReply
|
||||
3, // 9: messages.ControlPlane.Negotiate:output_type -> messages.NegotiateReply
|
||||
4, // 10: messages.ControlPlane.GetLocalActorIds:output_type -> messages.ActorIdsReply
|
||||
5, // 11: messages.ControlPlane.AnnounceOwnership:output_type -> messages.OwnerChangeAck
|
||||
10, // 12: messages.ControlPlane.Apply:output_type -> messages.ApplyResult
|
||||
5, // 13: messages.ControlPlane.AnnounceExpiry:output_type -> messages.OwnerChangeAck
|
||||
5, // 14: messages.ControlPlane.Closing:output_type -> messages.OwnerChangeAck
|
||||
8, // [8:15] is the sub-list for method output_type
|
||||
1, // [1:8] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_control_plane_proto_init() }
|
||||
@@ -562,13 +676,14 @@ func file_control_plane_proto_init() {
|
||||
if File_control_plane_proto != nil {
|
||||
return
|
||||
}
|
||||
file_messages_proto_init()
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_control_plane_proto_rawDesc), len(file_control_plane_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 9,
|
||||
NumMessages: 11,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
||||
@@ -23,6 +23,7 @@ const (
|
||||
ControlPlane_Negotiate_FullMethodName = "/messages.ControlPlane/Negotiate"
|
||||
ControlPlane_GetLocalActorIds_FullMethodName = "/messages.ControlPlane/GetLocalActorIds"
|
||||
ControlPlane_AnnounceOwnership_FullMethodName = "/messages.ControlPlane/AnnounceOwnership"
|
||||
ControlPlane_Apply_FullMethodName = "/messages.ControlPlane/Apply"
|
||||
ControlPlane_AnnounceExpiry_FullMethodName = "/messages.ControlPlane/AnnounceExpiry"
|
||||
ControlPlane_Closing_FullMethodName = "/messages.ControlPlane/Closing"
|
||||
)
|
||||
@@ -41,6 +42,7 @@ type ControlPlaneClient interface {
|
||||
GetLocalActorIds(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ActorIdsReply, error)
|
||||
// Ownership announcement: first-touch claim broadcast (idempotent; best-effort).
|
||||
AnnounceOwnership(ctx context.Context, in *OwnershipAnnounce, opts ...grpc.CallOption) (*OwnerChangeAck, error)
|
||||
Apply(ctx context.Context, in *ApplyRequest, opts ...grpc.CallOption) (*ApplyResult, error)
|
||||
// Expiry announcement: drop remote ownership hints when local TTL expires.
|
||||
AnnounceExpiry(ctx context.Context, in *ExpiryAnnounce, opts ...grpc.CallOption) (*OwnerChangeAck, error)
|
||||
// Closing announces graceful shutdown so peers can proactively adjust.
|
||||
@@ -95,6 +97,16 @@ func (c *controlPlaneClient) AnnounceOwnership(ctx context.Context, in *Ownershi
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *controlPlaneClient) Apply(ctx context.Context, in *ApplyRequest, opts ...grpc.CallOption) (*ApplyResult, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ApplyResult)
|
||||
err := c.cc.Invoke(ctx, ControlPlane_Apply_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *controlPlaneClient) AnnounceExpiry(ctx context.Context, in *ExpiryAnnounce, opts ...grpc.CallOption) (*OwnerChangeAck, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(OwnerChangeAck)
|
||||
@@ -129,6 +141,7 @@ type ControlPlaneServer interface {
|
||||
GetLocalActorIds(context.Context, *Empty) (*ActorIdsReply, error)
|
||||
// Ownership announcement: first-touch claim broadcast (idempotent; best-effort).
|
||||
AnnounceOwnership(context.Context, *OwnershipAnnounce) (*OwnerChangeAck, error)
|
||||
Apply(context.Context, *ApplyRequest) (*ApplyResult, error)
|
||||
// Expiry announcement: drop remote ownership hints when local TTL expires.
|
||||
AnnounceExpiry(context.Context, *ExpiryAnnounce) (*OwnerChangeAck, error)
|
||||
// Closing announces graceful shutdown so peers can proactively adjust.
|
||||
@@ -155,6 +168,9 @@ func (UnimplementedControlPlaneServer) GetLocalActorIds(context.Context, *Empty)
|
||||
func (UnimplementedControlPlaneServer) AnnounceOwnership(context.Context, *OwnershipAnnounce) (*OwnerChangeAck, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AnnounceOwnership not implemented")
|
||||
}
|
||||
func (UnimplementedControlPlaneServer) Apply(context.Context, *ApplyRequest) (*ApplyResult, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Apply not implemented")
|
||||
}
|
||||
func (UnimplementedControlPlaneServer) AnnounceExpiry(context.Context, *ExpiryAnnounce) (*OwnerChangeAck, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AnnounceExpiry not implemented")
|
||||
}
|
||||
@@ -254,6 +270,24 @@ func _ControlPlane_AnnounceOwnership_Handler(srv interface{}, ctx context.Contex
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ControlPlane_Apply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ApplyRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ControlPlaneServer).Apply(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ControlPlane_Apply_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ControlPlaneServer).Apply(ctx, req.(*ApplyRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ControlPlane_AnnounceExpiry_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ExpiryAnnounce)
|
||||
if err := dec(in); err != nil {
|
||||
@@ -313,6 +347,10 @@ var ControlPlane_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "AnnounceOwnership",
|
||||
Handler: _ControlPlane_AnnounceOwnership_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Apply",
|
||||
Handler: _ControlPlane_Apply_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AnnounceExpiry",
|
||||
Handler: _ControlPlane_AnnounceExpiry_Handler,
|
||||
|
||||
@@ -1711,6 +1711,440 @@ func (x *RemoveGiftcard) GetId() uint32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
type Mutation struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// Types that are valid to be assigned to Type:
|
||||
//
|
||||
// *Mutation_ClearCart
|
||||
// *Mutation_AddItem
|
||||
// *Mutation_RemoveItem
|
||||
// *Mutation_ChangeQuantity
|
||||
// *Mutation_SetDelivery
|
||||
// *Mutation_SetPickupPoint
|
||||
// *Mutation_RemoveDelivery
|
||||
// *Mutation_SetUserId
|
||||
// *Mutation_LineItemMarking
|
||||
// *Mutation_RemoveLineItemMarking
|
||||
// *Mutation_SubscriptionAdded
|
||||
// *Mutation_PaymentDeclined
|
||||
// *Mutation_ConfirmationViewed
|
||||
// *Mutation_CreateCheckoutOrder
|
||||
// *Mutation_OrderCreated
|
||||
// *Mutation_Noop
|
||||
// *Mutation_InitializeCheckout
|
||||
// *Mutation_InventoryReserved
|
||||
// *Mutation_AddVoucher
|
||||
// *Mutation_RemoveVoucher
|
||||
// *Mutation_UpsertSubscriptionDetails
|
||||
// *Mutation_PreConditionFailed
|
||||
// *Mutation_AddGiftcard
|
||||
// *Mutation_RemoveGiftcard
|
||||
Type isMutation_Type `protobuf_oneof:"type"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Mutation) Reset() {
|
||||
*x = Mutation{}
|
||||
mi := &file_messages_proto_msgTypes[26]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Mutation) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Mutation) ProtoMessage() {}
|
||||
|
||||
func (x *Mutation) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_messages_proto_msgTypes[26]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Mutation.ProtoReflect.Descriptor instead.
|
||||
func (*Mutation) Descriptor() ([]byte, []int) {
|
||||
return file_messages_proto_rawDescGZIP(), []int{26}
|
||||
}
|
||||
|
||||
func (x *Mutation) GetType() isMutation_Type {
|
||||
if x != nil {
|
||||
return x.Type
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetClearCart() *ClearCartRequest {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_ClearCart); ok {
|
||||
return x.ClearCart
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetAddItem() *AddItem {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_AddItem); ok {
|
||||
return x.AddItem
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetRemoveItem() *RemoveItem {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_RemoveItem); ok {
|
||||
return x.RemoveItem
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetChangeQuantity() *ChangeQuantity {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_ChangeQuantity); ok {
|
||||
return x.ChangeQuantity
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetSetDelivery() *SetDelivery {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_SetDelivery); ok {
|
||||
return x.SetDelivery
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetSetPickupPoint() *SetPickupPoint {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_SetPickupPoint); ok {
|
||||
return x.SetPickupPoint
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetRemoveDelivery() *RemoveDelivery {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_RemoveDelivery); ok {
|
||||
return x.RemoveDelivery
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetSetUserId() *SetUserId {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_SetUserId); ok {
|
||||
return x.SetUserId
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetLineItemMarking() *LineItemMarking {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_LineItemMarking); ok {
|
||||
return x.LineItemMarking
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetRemoveLineItemMarking() *RemoveLineItemMarking {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_RemoveLineItemMarking); ok {
|
||||
return x.RemoveLineItemMarking
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetSubscriptionAdded() *SubscriptionAdded {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_SubscriptionAdded); ok {
|
||||
return x.SubscriptionAdded
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetPaymentDeclined() *PaymentDeclined {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_PaymentDeclined); ok {
|
||||
return x.PaymentDeclined
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetConfirmationViewed() *ConfirmationViewed {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_ConfirmationViewed); ok {
|
||||
return x.ConfirmationViewed
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetCreateCheckoutOrder() *CreateCheckoutOrder {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_CreateCheckoutOrder); ok {
|
||||
return x.CreateCheckoutOrder
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetOrderCreated() *OrderCreated {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_OrderCreated); ok {
|
||||
return x.OrderCreated
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetNoop() *Noop {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_Noop); ok {
|
||||
return x.Noop
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetInitializeCheckout() *InitializeCheckout {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_InitializeCheckout); ok {
|
||||
return x.InitializeCheckout
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetInventoryReserved() *InventoryReserved {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_InventoryReserved); ok {
|
||||
return x.InventoryReserved
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetAddVoucher() *AddVoucher {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_AddVoucher); ok {
|
||||
return x.AddVoucher
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetRemoveVoucher() *RemoveVoucher {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_RemoveVoucher); ok {
|
||||
return x.RemoveVoucher
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetUpsertSubscriptionDetails() *UpsertSubscriptionDetails {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_UpsertSubscriptionDetails); ok {
|
||||
return x.UpsertSubscriptionDetails
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetPreConditionFailed() *PreConditionFailed {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_PreConditionFailed); ok {
|
||||
return x.PreConditionFailed
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetAddGiftcard() *AddGiftcard {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_AddGiftcard); ok {
|
||||
return x.AddGiftcard
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Mutation) GetRemoveGiftcard() *RemoveGiftcard {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*Mutation_RemoveGiftcard); ok {
|
||||
return x.RemoveGiftcard
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type isMutation_Type interface {
|
||||
isMutation_Type()
|
||||
}
|
||||
|
||||
type Mutation_ClearCart struct {
|
||||
ClearCart *ClearCartRequest `protobuf:"bytes,1,opt,name=clear_cart,json=clearCart,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Mutation_AddItem struct {
|
||||
AddItem *AddItem `protobuf:"bytes,2,opt,name=add_item,json=addItem,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Mutation_RemoveItem struct {
|
||||
RemoveItem *RemoveItem `protobuf:"bytes,3,opt,name=remove_item,json=removeItem,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Mutation_ChangeQuantity struct {
|
||||
ChangeQuantity *ChangeQuantity `protobuf:"bytes,4,opt,name=change_quantity,json=changeQuantity,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Mutation_SetDelivery struct {
|
||||
SetDelivery *SetDelivery `protobuf:"bytes,5,opt,name=set_delivery,json=setDelivery,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Mutation_SetPickupPoint struct {
|
||||
SetPickupPoint *SetPickupPoint `protobuf:"bytes,6,opt,name=set_pickup_point,json=setPickupPoint,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Mutation_RemoveDelivery struct {
|
||||
RemoveDelivery *RemoveDelivery `protobuf:"bytes,7,opt,name=remove_delivery,json=removeDelivery,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Mutation_SetUserId struct {
|
||||
SetUserId *SetUserId `protobuf:"bytes,8,opt,name=set_user_id,json=setUserId,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Mutation_LineItemMarking struct {
|
||||
LineItemMarking *LineItemMarking `protobuf:"bytes,9,opt,name=line_item_marking,json=lineItemMarking,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Mutation_RemoveLineItemMarking struct {
|
||||
RemoveLineItemMarking *RemoveLineItemMarking `protobuf:"bytes,10,opt,name=remove_line_item_marking,json=removeLineItemMarking,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Mutation_SubscriptionAdded struct {
|
||||
SubscriptionAdded *SubscriptionAdded `protobuf:"bytes,11,opt,name=subscription_added,json=subscriptionAdded,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Mutation_PaymentDeclined struct {
|
||||
PaymentDeclined *PaymentDeclined `protobuf:"bytes,12,opt,name=payment_declined,json=paymentDeclined,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Mutation_ConfirmationViewed struct {
|
||||
ConfirmationViewed *ConfirmationViewed `protobuf:"bytes,13,opt,name=confirmation_viewed,json=confirmationViewed,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Mutation_CreateCheckoutOrder struct {
|
||||
CreateCheckoutOrder *CreateCheckoutOrder `protobuf:"bytes,14,opt,name=create_checkout_order,json=createCheckoutOrder,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Mutation_OrderCreated struct {
|
||||
OrderCreated *OrderCreated `protobuf:"bytes,15,opt,name=order_created,json=orderCreated,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Mutation_Noop struct {
|
||||
Noop *Noop `protobuf:"bytes,16,opt,name=noop,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Mutation_InitializeCheckout struct {
|
||||
InitializeCheckout *InitializeCheckout `protobuf:"bytes,17,opt,name=initialize_checkout,json=initializeCheckout,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Mutation_InventoryReserved struct {
|
||||
InventoryReserved *InventoryReserved `protobuf:"bytes,18,opt,name=inventory_reserved,json=inventoryReserved,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Mutation_AddVoucher struct {
|
||||
AddVoucher *AddVoucher `protobuf:"bytes,19,opt,name=add_voucher,json=addVoucher,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Mutation_RemoveVoucher struct {
|
||||
RemoveVoucher *RemoveVoucher `protobuf:"bytes,20,opt,name=remove_voucher,json=removeVoucher,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Mutation_UpsertSubscriptionDetails struct {
|
||||
UpsertSubscriptionDetails *UpsertSubscriptionDetails `protobuf:"bytes,21,opt,name=upsert_subscription_details,json=upsertSubscriptionDetails,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Mutation_PreConditionFailed struct {
|
||||
PreConditionFailed *PreConditionFailed `protobuf:"bytes,22,opt,name=pre_condition_failed,json=preConditionFailed,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Mutation_AddGiftcard struct {
|
||||
AddGiftcard *AddGiftcard `protobuf:"bytes,23,opt,name=add_giftcard,json=addGiftcard,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Mutation_RemoveGiftcard struct {
|
||||
RemoveGiftcard *RemoveGiftcard `protobuf:"bytes,24,opt,name=remove_giftcard,json=removeGiftcard,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*Mutation_ClearCart) isMutation_Type() {}
|
||||
|
||||
func (*Mutation_AddItem) isMutation_Type() {}
|
||||
|
||||
func (*Mutation_RemoveItem) isMutation_Type() {}
|
||||
|
||||
func (*Mutation_ChangeQuantity) isMutation_Type() {}
|
||||
|
||||
func (*Mutation_SetDelivery) isMutation_Type() {}
|
||||
|
||||
func (*Mutation_SetPickupPoint) isMutation_Type() {}
|
||||
|
||||
func (*Mutation_RemoveDelivery) isMutation_Type() {}
|
||||
|
||||
func (*Mutation_SetUserId) isMutation_Type() {}
|
||||
|
||||
func (*Mutation_LineItemMarking) isMutation_Type() {}
|
||||
|
||||
func (*Mutation_RemoveLineItemMarking) isMutation_Type() {}
|
||||
|
||||
func (*Mutation_SubscriptionAdded) isMutation_Type() {}
|
||||
|
||||
func (*Mutation_PaymentDeclined) isMutation_Type() {}
|
||||
|
||||
func (*Mutation_ConfirmationViewed) isMutation_Type() {}
|
||||
|
||||
func (*Mutation_CreateCheckoutOrder) isMutation_Type() {}
|
||||
|
||||
func (*Mutation_OrderCreated) isMutation_Type() {}
|
||||
|
||||
func (*Mutation_Noop) isMutation_Type() {}
|
||||
|
||||
func (*Mutation_InitializeCheckout) isMutation_Type() {}
|
||||
|
||||
func (*Mutation_InventoryReserved) isMutation_Type() {}
|
||||
|
||||
func (*Mutation_AddVoucher) isMutation_Type() {}
|
||||
|
||||
func (*Mutation_RemoveVoucher) isMutation_Type() {}
|
||||
|
||||
func (*Mutation_UpsertSubscriptionDetails) isMutation_Type() {}
|
||||
|
||||
func (*Mutation_PreConditionFailed) isMutation_Type() {}
|
||||
|
||||
func (*Mutation_AddGiftcard) isMutation_Type() {}
|
||||
|
||||
func (*Mutation_RemoveGiftcard) isMutation_Type() {}
|
||||
|
||||
var File_messages_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_messages_proto_rawDesc = string([]byte{
|
||||
@@ -1929,10 +2363,115 @@ var file_messages_proto_rawDesc = string([]byte{
|
||||
0x72, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x08, 0x67, 0x69, 0x66, 0x74, 0x63, 0x61, 0x72, 0x64,
|
||||
0x22, 0x20, 0x0a, 0x0e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x47, 0x69, 0x66, 0x74, 0x63, 0x61,
|
||||
0x72, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02,
|
||||
0x69, 0x64, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x2e, 0x6b, 0x36, 0x6e, 0x2e, 0x6e, 0x65,
|
||||
0x74, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x61, 0x72, 0x74, 0x2d, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x2f,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x69, 0x64, 0x22, 0x95, 0x0d, 0x0a, 0x08, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12,
|
||||
0x3b, 0x0a, 0x0a, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x43,
|
||||
0x6c, 0x65, 0x61, 0x72, 0x43, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48,
|
||||
0x00, 0x52, 0x09, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x43, 0x61, 0x72, 0x74, 0x12, 0x2e, 0x0a, 0x08,
|
||||
0x61, 0x64, 0x64, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11,
|
||||
0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x49, 0x74, 0x65,
|
||||
0x6d, 0x48, 0x00, 0x52, 0x07, 0x61, 0x64, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x37, 0x0a, 0x0b,
|
||||
0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x14, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x6d,
|
||||
0x6f, 0x76, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x00, 0x52, 0x0a, 0x72, 0x65, 0x6d, 0x6f, 0x76,
|
||||
0x65, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x43, 0x0a, 0x0f, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f,
|
||||
0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18,
|
||||
0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65,
|
||||
0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x0e, 0x63, 0x68, 0x61, 0x6e,
|
||||
0x67, 0x65, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x3a, 0x0a, 0x0c, 0x73, 0x65,
|
||||
0x74, 0x5f, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x15, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x53, 0x65, 0x74, 0x44,
|
||||
0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x65, 0x74, 0x44, 0x65,
|
||||
0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x12, 0x44, 0x0a, 0x10, 0x73, 0x65, 0x74, 0x5f, 0x70, 0x69,
|
||||
0x63, 0x6b, 0x75, 0x70, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x18, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x53, 0x65, 0x74, 0x50,
|
||||
0x69, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0e, 0x73, 0x65,
|
||||
0x74, 0x50, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0f,
|
||||
0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x18,
|
||||
0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73,
|
||||
0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x48,
|
||||
0x00, 0x52, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72,
|
||||
0x79, 0x12, 0x35, 0x0a, 0x0b, 0x73, 0x65, 0x74, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64,
|
||||
0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||
0x73, 0x2e, 0x53, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x48, 0x00, 0x52, 0x09, 0x73,
|
||||
0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x47, 0x0a, 0x11, 0x6c, 0x69, 0x6e, 0x65,
|
||||
0x5f, 0x69, 0x74, 0x65, 0x6d, 0x5f, 0x6d, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x09, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4c,
|
||||
0x69, 0x6e, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x4d, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x48, 0x00,
|
||||
0x52, 0x0f, 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x4d, 0x61, 0x72, 0x6b, 0x69, 0x6e,
|
||||
0x67, 0x12, 0x5a, 0x0a, 0x18, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x6c, 0x69, 0x6e, 0x65,
|
||||
0x5f, 0x69, 0x74, 0x65, 0x6d, 0x5f, 0x6d, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x0a, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x52,
|
||||
0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4c, 0x69, 0x6e, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x4d, 0x61, 0x72,
|
||||
0x6b, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x15, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4c, 0x69,
|
||||
0x6e, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x4d, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x4c, 0x0a,
|
||||
0x12, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x64,
|
||||
0x64, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6d, 0x65, 0x73, 0x73,
|
||||
0x61, 0x67, 0x65, 0x73, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x41, 0x64, 0x64, 0x65, 0x64, 0x48, 0x00, 0x52, 0x11, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72,
|
||||
0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x65, 0x64, 0x12, 0x46, 0x0a, 0x10, 0x70,
|
||||
0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x64, 0x65, 0x63, 0x6c, 0x69, 0x6e, 0x65, 0x64, 0x18,
|
||||
0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73,
|
||||
0x2e, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x63, 0x6c, 0x69, 0x6e, 0x65, 0x64,
|
||||
0x48, 0x00, 0x52, 0x0f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x63, 0x6c, 0x69,
|
||||
0x6e, 0x65, 0x64, 0x12, 0x4f, 0x0a, 0x13, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x65, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x1c, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x66,
|
||||
0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x69, 0x65, 0x77, 0x65, 0x64, 0x48, 0x00,
|
||||
0x52, 0x12, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x69,
|
||||
0x65, 0x77, 0x65, 0x64, 0x12, 0x53, 0x0a, 0x15, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x63,
|
||||
0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x0e, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x43,
|
||||
0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x4f, 0x72, 0x64,
|
||||
0x65, 0x72, 0x48, 0x00, 0x52, 0x13, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x68, 0x65, 0x63,
|
||||
0x6b, 0x6f, 0x75, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x3d, 0x0a, 0x0d, 0x6f, 0x72, 0x64,
|
||||
0x65, 0x72, 0x5f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x16, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4f, 0x72, 0x64, 0x65,
|
||||
0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0c, 0x6f, 0x72, 0x64, 0x65,
|
||||
0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x24, 0x0a, 0x04, 0x6e, 0x6f, 0x6f, 0x70,
|
||||
0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||
0x73, 0x2e, 0x4e, 0x6f, 0x6f, 0x70, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x6f, 0x6f, 0x70, 0x12, 0x4f,
|
||||
0x0a, 0x13, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x5f, 0x63, 0x68, 0x65,
|
||||
0x63, 0x6b, 0x6f, 0x75, 0x74, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a,
|
||||
0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x48, 0x00, 0x52, 0x12, 0x69, 0x6e, 0x69,
|
||||
0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x12,
|
||||
0x4c, 0x0a, 0x12, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x72, 0x65, 0x73,
|
||||
0x65, 0x72, 0x76, 0x65, 0x64, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79,
|
||||
0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x48, 0x00, 0x52, 0x11, 0x69, 0x6e, 0x76, 0x65,
|
||||
0x6e, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x37, 0x0a,
|
||||
0x0b, 0x61, 0x64, 0x64, 0x5f, 0x76, 0x6f, 0x75, 0x63, 0x68, 0x65, 0x72, 0x18, 0x13, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x41, 0x64,
|
||||
0x64, 0x56, 0x6f, 0x75, 0x63, 0x68, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0a, 0x61, 0x64, 0x64, 0x56,
|
||||
0x6f, 0x75, 0x63, 0x68, 0x65, 0x72, 0x12, 0x40, 0x0a, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65,
|
||||
0x5f, 0x76, 0x6f, 0x75, 0x63, 0x68, 0x65, 0x72, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17,
|
||||
0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65,
|
||||
0x56, 0x6f, 0x75, 0x63, 0x68, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0d, 0x72, 0x65, 0x6d, 0x6f, 0x76,
|
||||
0x65, 0x56, 0x6f, 0x75, 0x63, 0x68, 0x65, 0x72, 0x12, 0x65, 0x0a, 0x1b, 0x75, 0x70, 0x73, 0x65,
|
||||
0x72, 0x74, 0x5f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f,
|
||||
0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e,
|
||||
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x53,
|
||||
0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69,
|
||||
0x6c, 0x73, 0x48, 0x00, 0x52, 0x19, 0x75, 0x70, 0x73, 0x65, 0x72, 0x74, 0x53, 0x75, 0x62, 0x73,
|
||||
0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12,
|
||||
0x50, 0x0a, 0x14, 0x70, 0x72, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x5f, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e,
|
||||
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x50, 0x72, 0x65, 0x43, 0x6f, 0x6e, 0x64,
|
||||
0x69, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x48, 0x00, 0x52, 0x12, 0x70,
|
||||
0x72, 0x65, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65,
|
||||
0x64, 0x12, 0x3a, 0x0a, 0x0c, 0x61, 0x64, 0x64, 0x5f, 0x67, 0x69, 0x66, 0x74, 0x63, 0x61, 0x72,
|
||||
0x64, 0x18, 0x17, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
|
||||
0x65, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x47, 0x69, 0x66, 0x74, 0x63, 0x61, 0x72, 0x64, 0x48, 0x00,
|
||||
0x52, 0x0b, 0x61, 0x64, 0x64, 0x47, 0x69, 0x66, 0x74, 0x63, 0x61, 0x72, 0x64, 0x12, 0x43, 0x0a,
|
||||
0x0f, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x67, 0x69, 0x66, 0x74, 0x63, 0x61, 0x72, 0x64,
|
||||
0x18, 0x18, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||
0x73, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x47, 0x69, 0x66, 0x74, 0x63, 0x61, 0x72, 0x64,
|
||||
0x48, 0x00, 0x52, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x47, 0x69, 0x66, 0x74, 0x63, 0x61,
|
||||
0x72, 0x64, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69,
|
||||
0x74, 0x2e, 0x6b, 0x36, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x61, 0x72,
|
||||
0x74, 0x2d, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x6d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
})
|
||||
|
||||
var (
|
||||
@@ -1947,7 +2486,7 @@ func file_messages_proto_rawDescGZIP() []byte {
|
||||
return file_messages_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_messages_proto_msgTypes = make([]protoimpl.MessageInfo, 26)
|
||||
var file_messages_proto_msgTypes = make([]protoimpl.MessageInfo, 27)
|
||||
var file_messages_proto_goTypes = []any{
|
||||
(*ClearCartRequest)(nil), // 0: messages.ClearCartRequest
|
||||
(*AddItem)(nil), // 1: messages.AddItem
|
||||
@@ -1975,21 +2514,46 @@ var file_messages_proto_goTypes = []any{
|
||||
(*GiftcardItem)(nil), // 23: messages.GiftcardItem
|
||||
(*AddGiftcard)(nil), // 24: messages.AddGiftcard
|
||||
(*RemoveGiftcard)(nil), // 25: messages.RemoveGiftcard
|
||||
(*timestamppb.Timestamp)(nil), // 26: google.protobuf.Timestamp
|
||||
(*anypb.Any)(nil), // 27: google.protobuf.Any
|
||||
(*Mutation)(nil), // 26: messages.Mutation
|
||||
(*timestamppb.Timestamp)(nil), // 27: google.protobuf.Timestamp
|
||||
(*anypb.Any)(nil), // 28: google.protobuf.Any
|
||||
}
|
||||
var file_messages_proto_depIdxs = []int32{
|
||||
26, // 0: messages.AddItem.reservationEndTime:type_name -> google.protobuf.Timestamp
|
||||
27, // 0: messages.AddItem.reservationEndTime:type_name -> google.protobuf.Timestamp
|
||||
6, // 1: messages.SetDelivery.pickupPoint:type_name -> messages.PickupPoint
|
||||
27, // 2: messages.UpsertSubscriptionDetails.data:type_name -> google.protobuf.Any
|
||||
27, // 3: messages.PreConditionFailed.input:type_name -> google.protobuf.Any
|
||||
27, // 4: messages.GiftcardItem.designConfig:type_name -> google.protobuf.Any
|
||||
28, // 2: messages.UpsertSubscriptionDetails.data:type_name -> google.protobuf.Any
|
||||
28, // 3: messages.PreConditionFailed.input:type_name -> google.protobuf.Any
|
||||
28, // 4: messages.GiftcardItem.designConfig:type_name -> google.protobuf.Any
|
||||
23, // 5: messages.AddGiftcard.giftcard:type_name -> messages.GiftcardItem
|
||||
6, // [6:6] is the sub-list for method output_type
|
||||
6, // [6:6] is the sub-list for method input_type
|
||||
6, // [6:6] is the sub-list for extension type_name
|
||||
6, // [6:6] is the sub-list for extension extendee
|
||||
0, // [0:6] is the sub-list for field type_name
|
||||
0, // 6: messages.Mutation.clear_cart:type_name -> messages.ClearCartRequest
|
||||
1, // 7: messages.Mutation.add_item:type_name -> messages.AddItem
|
||||
2, // 8: messages.Mutation.remove_item:type_name -> messages.RemoveItem
|
||||
3, // 9: messages.Mutation.change_quantity:type_name -> messages.ChangeQuantity
|
||||
4, // 10: messages.Mutation.set_delivery:type_name -> messages.SetDelivery
|
||||
5, // 11: messages.Mutation.set_pickup_point:type_name -> messages.SetPickupPoint
|
||||
7, // 12: messages.Mutation.remove_delivery:type_name -> messages.RemoveDelivery
|
||||
8, // 13: messages.Mutation.set_user_id:type_name -> messages.SetUserId
|
||||
9, // 14: messages.Mutation.line_item_marking:type_name -> messages.LineItemMarking
|
||||
10, // 15: messages.Mutation.remove_line_item_marking:type_name -> messages.RemoveLineItemMarking
|
||||
11, // 16: messages.Mutation.subscription_added:type_name -> messages.SubscriptionAdded
|
||||
12, // 17: messages.Mutation.payment_declined:type_name -> messages.PaymentDeclined
|
||||
13, // 18: messages.Mutation.confirmation_viewed:type_name -> messages.ConfirmationViewed
|
||||
14, // 19: messages.Mutation.create_checkout_order:type_name -> messages.CreateCheckoutOrder
|
||||
15, // 20: messages.Mutation.order_created:type_name -> messages.OrderCreated
|
||||
16, // 21: messages.Mutation.noop:type_name -> messages.Noop
|
||||
17, // 22: messages.Mutation.initialize_checkout:type_name -> messages.InitializeCheckout
|
||||
18, // 23: messages.Mutation.inventory_reserved:type_name -> messages.InventoryReserved
|
||||
19, // 24: messages.Mutation.add_voucher:type_name -> messages.AddVoucher
|
||||
20, // 25: messages.Mutation.remove_voucher:type_name -> messages.RemoveVoucher
|
||||
21, // 26: messages.Mutation.upsert_subscription_details:type_name -> messages.UpsertSubscriptionDetails
|
||||
22, // 27: messages.Mutation.pre_condition_failed:type_name -> messages.PreConditionFailed
|
||||
24, // 28: messages.Mutation.add_giftcard:type_name -> messages.AddGiftcard
|
||||
25, // 29: messages.Mutation.remove_giftcard:type_name -> messages.RemoveGiftcard
|
||||
30, // [30:30] is the sub-list for method output_type
|
||||
30, // [30:30] is the sub-list for method input_type
|
||||
30, // [30:30] is the sub-list for extension type_name
|
||||
30, // [30:30] is the sub-list for extension extendee
|
||||
0, // [0:30] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_messages_proto_init() }
|
||||
@@ -2005,13 +2569,39 @@ func file_messages_proto_init() {
|
||||
file_messages_proto_msgTypes[18].OneofWrappers = []any{}
|
||||
file_messages_proto_msgTypes[21].OneofWrappers = []any{}
|
||||
file_messages_proto_msgTypes[23].OneofWrappers = []any{}
|
||||
file_messages_proto_msgTypes[26].OneofWrappers = []any{
|
||||
(*Mutation_ClearCart)(nil),
|
||||
(*Mutation_AddItem)(nil),
|
||||
(*Mutation_RemoveItem)(nil),
|
||||
(*Mutation_ChangeQuantity)(nil),
|
||||
(*Mutation_SetDelivery)(nil),
|
||||
(*Mutation_SetPickupPoint)(nil),
|
||||
(*Mutation_RemoveDelivery)(nil),
|
||||
(*Mutation_SetUserId)(nil),
|
||||
(*Mutation_LineItemMarking)(nil),
|
||||
(*Mutation_RemoveLineItemMarking)(nil),
|
||||
(*Mutation_SubscriptionAdded)(nil),
|
||||
(*Mutation_PaymentDeclined)(nil),
|
||||
(*Mutation_ConfirmationViewed)(nil),
|
||||
(*Mutation_CreateCheckoutOrder)(nil),
|
||||
(*Mutation_OrderCreated)(nil),
|
||||
(*Mutation_Noop)(nil),
|
||||
(*Mutation_InitializeCheckout)(nil),
|
||||
(*Mutation_InventoryReserved)(nil),
|
||||
(*Mutation_AddVoucher)(nil),
|
||||
(*Mutation_RemoveVoucher)(nil),
|
||||
(*Mutation_UpsertSubscriptionDetails)(nil),
|
||||
(*Mutation_PreConditionFailed)(nil),
|
||||
(*Mutation_AddGiftcard)(nil),
|
||||
(*Mutation_RemoveGiftcard)(nil),
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_messages_proto_rawDesc), len(file_messages_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 26,
|
||||
NumMessages: 27,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"time"
|
||||
|
||||
messages "git.k6n.net/go-cart-actor/pkg/messages"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"go.opentelemetry.io/contrib/bridges/otelslog"
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
@@ -100,6 +101,79 @@ func (h *RemoteHost) Ping() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (h *RemoteHost) Apply(ctx context.Context, id uint64, mutation ...proto.Message) (bool, error) {
|
||||
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
|
||||
defer cancel()
|
||||
|
||||
toSend := make([]*messages.Mutation, len(mutation))
|
||||
for i, msg := range mutation {
|
||||
switch m := msg.(type) {
|
||||
case *messages.ClearCartRequest:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_ClearCart{ClearCart: m}}
|
||||
case *messages.AddItem:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_AddItem{AddItem: m}}
|
||||
case *messages.RemoveItem:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_RemoveItem{RemoveItem: m}}
|
||||
case *messages.ChangeQuantity:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_ChangeQuantity{ChangeQuantity: m}}
|
||||
case *messages.SetDelivery:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_SetDelivery{SetDelivery: m}}
|
||||
case *messages.SetPickupPoint:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_SetPickupPoint{SetPickupPoint: m}}
|
||||
case *messages.RemoveDelivery:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_RemoveDelivery{RemoveDelivery: m}}
|
||||
case *messages.SetUserId:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_SetUserId{SetUserId: m}}
|
||||
case *messages.LineItemMarking:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_LineItemMarking{LineItemMarking: m}}
|
||||
case *messages.RemoveLineItemMarking:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_RemoveLineItemMarking{RemoveLineItemMarking: m}}
|
||||
case *messages.SubscriptionAdded:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_SubscriptionAdded{SubscriptionAdded: m}}
|
||||
case *messages.PaymentDeclined:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_PaymentDeclined{PaymentDeclined: m}}
|
||||
case *messages.ConfirmationViewed:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_ConfirmationViewed{ConfirmationViewed: m}}
|
||||
case *messages.CreateCheckoutOrder:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_CreateCheckoutOrder{CreateCheckoutOrder: m}}
|
||||
case *messages.OrderCreated:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_OrderCreated{OrderCreated: m}}
|
||||
case *messages.Noop:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_Noop{Noop: m}}
|
||||
case *messages.InitializeCheckout:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_InitializeCheckout{InitializeCheckout: m}}
|
||||
case *messages.InventoryReserved:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_InventoryReserved{InventoryReserved: m}}
|
||||
case *messages.AddVoucher:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_AddVoucher{AddVoucher: m}}
|
||||
case *messages.RemoveVoucher:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_RemoveVoucher{RemoveVoucher: m}}
|
||||
case *messages.UpsertSubscriptionDetails:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_UpsertSubscriptionDetails{UpsertSubscriptionDetails: m}}
|
||||
case *messages.PreConditionFailed:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_PreConditionFailed{PreConditionFailed: m}}
|
||||
case *messages.AddGiftcard:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_AddGiftcard{AddGiftcard: m}}
|
||||
case *messages.RemoveGiftcard:
|
||||
toSend[i] = &messages.Mutation{Type: &messages.Mutation_RemoveGiftcard{RemoveGiftcard: m}}
|
||||
default:
|
||||
toSend[i] = nil
|
||||
}
|
||||
}
|
||||
|
||||
resp, err := h.controlClient.Apply(ctx, &messages.ApplyRequest{
|
||||
Id: id,
|
||||
Messages: toSend,
|
||||
})
|
||||
if err != nil {
|
||||
h.missedPings++
|
||||
log.Printf("Apply %s failed: %v", h.host, err)
|
||||
return false, err
|
||||
}
|
||||
h.missedPings = 0
|
||||
return resp.Accepted, nil
|
||||
}
|
||||
|
||||
func (h *RemoteHost) Negotiate(knownHosts []string) ([]string, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
|
||||
@@ -4,6 +4,8 @@ package messages;
|
||||
|
||||
option go_package = "git.k6n.net/go-cart-actor/proto;messages";
|
||||
|
||||
import "messages.proto";
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Control Plane gRPC API
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -65,6 +67,16 @@ message ExpiryAnnounce {
|
||||
repeated uint64 ids = 2;
|
||||
}
|
||||
|
||||
message ApplyRequest {
|
||||
|
||||
uint64 id = 1;
|
||||
repeated Mutation messages = 2;
|
||||
}
|
||||
|
||||
message ApplyResult {
|
||||
bool accepted = 1;
|
||||
}
|
||||
|
||||
// ControlPlane defines cluster coordination and ownership operations.
|
||||
service ControlPlane {
|
||||
// Ping for liveness; lightweight health signal.
|
||||
@@ -80,6 +92,7 @@ service ControlPlane {
|
||||
|
||||
// Ownership announcement: first-touch claim broadcast (idempotent; best-effort).
|
||||
rpc AnnounceOwnership(OwnershipAnnounce) returns (OwnerChangeAck);
|
||||
rpc Apply(ApplyRequest) returns (ApplyResult);
|
||||
|
||||
// Expiry announcement: drop remote ownership hints when local TTL expires.
|
||||
rpc AnnounceExpiry(ExpiryAnnounce) returns (OwnerChangeAck);
|
||||
|
||||
@@ -171,3 +171,32 @@ message AddGiftcard {
|
||||
message RemoveGiftcard {
|
||||
uint32 id = 1;
|
||||
}
|
||||
|
||||
message Mutation {
|
||||
oneof type {
|
||||
ClearCartRequest clear_cart = 1;
|
||||
AddItem add_item = 2;
|
||||
RemoveItem remove_item = 3;
|
||||
ChangeQuantity change_quantity = 4;
|
||||
SetDelivery set_delivery = 5;
|
||||
SetPickupPoint set_pickup_point = 6;
|
||||
RemoveDelivery remove_delivery = 7;
|
||||
SetUserId set_user_id = 8;
|
||||
LineItemMarking line_item_marking = 9;
|
||||
RemoveLineItemMarking remove_line_item_marking = 10;
|
||||
SubscriptionAdded subscription_added = 11;
|
||||
PaymentDeclined payment_declined = 12;
|
||||
ConfirmationViewed confirmation_viewed = 13;
|
||||
CreateCheckoutOrder create_checkout_order = 14;
|
||||
OrderCreated order_created = 15;
|
||||
Noop noop = 16;
|
||||
InitializeCheckout initialize_checkout = 17;
|
||||
InventoryReserved inventory_reserved = 18;
|
||||
AddVoucher add_voucher = 19;
|
||||
RemoveVoucher remove_voucher = 20;
|
||||
UpsertSubscriptionDetails upsert_subscription_details = 21;
|
||||
PreConditionFailed pre_condition_failed = 22;
|
||||
AddGiftcard add_giftcard = 23;
|
||||
RemoveGiftcard remove_giftcard = 24;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user