All Downloads are FREE. Search and download functionalities are using the official Maven repository.

kalix.tck.model.view.view.proto Maven / Gradle / Ivy

// Copyright 2022 Lightbend Inc.

//
// == Kalix TCK model test for views ==
// see tck/src/main/scala/com/kalix/tck/ViewTCK.scala

syntax = "proto3";

package kalix.tck.model.view;

import "google/protobuf/empty.proto";
import "kalix/annotations.proto";

option go_package = "github.com/lightbend/kalix-go-sdk/tck/view;view";
option java_package = "kalix.tck.model";

//
// The `ViewTckModel` service should be implemented in the following ways:
//
// - The `ProcessUpdateUnary` method unary receive `Event` messages with directions what to do:
//   - The `ReturnAsIsEvent` should return a `ViewState` with the data string copied as is
//   - The `UppercaseThisEvent` should return a `ViewState` with the data string copied and uppercased
//   - The `AppendToExistingState` should return a `ViewState` with the previous view state data string copied and lowercased
//   - The `Ignore` should return nothing (view protocol response `Empty`) to signal not doing any update for the incoming event
//
service ViewTckModel {
  option (kalix.service) = {type: SERVICE_TYPE_VIEW};
  rpc ProcessUpdateUnary(Event) returns (ViewState) {
    option (kalix.method).eventing.in = {value_entity: "view-source"};
    option (kalix.method).view.update = {table: "view_model"};
  }
  // not really used but needed for the service to be valid
  rpc DummyQuery(google.protobuf.Empty) returns (stream ViewState) {
    option (kalix.method).view.query = {query: "SELECT * FROM view_model"};
  }
}

//
// The `ViewTckSource` service should be registered as a Value Entity with entity type "view-source".
// This is used as the configured event source for the ViewTckModel, but doesn't do anything itself.
//
service ViewTckSource {}

//
// An `Event` message contains the type of action to take and the state data.
//
message Event {
  oneof event {
    ReturnAsIsEvent return_as_is = 1;
    UppercaseThisEvent uppercase_this = 2;
    AppendToExistingState append_to_existing_state = 3;
    FailEvent fail = 4;
    Ignore ignore = 5;
  }
}

message ReturnAsIsEvent {
  string data = 1;
}

message UppercaseThisEvent {
  string data = 1;
}

message AppendToExistingState {
  string data = 1;
}

message FailEvent {}

message Ignore {}

// The `ViewState` to return after applying an event
message ViewState {
  string data = 1;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy