add function to apply mutations over grpc
All checks were successful
Build and Publish / BuildAndDeployAmd64 (push) Successful in 41s
Build and Publish / BuildAndDeployArm64 (push) Successful in 4m50s

This commit is contained in:
matst80
2025-11-28 14:07:43 +01:00
parent 2c0f6c160a
commit 47e69f18a5
12 changed files with 1015 additions and 74 deletions

View File

@@ -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);

View File

@@ -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;
}
}