mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 01:18:34 +00:00
check in codegen'd protos
This commit is contained in:
1 parent
d5a329469e
commit
876b149331
4 files changed
+375
-2
No files matched your search
@@ -1,7 +1,12 @@
|
||||
extern crate anyhow; // TODO: No!
|
||||
extern crate prost_build;
|
||||
|
||||
use std::env;
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
// NB: Control prost output dir with env var
|
||||
env::set_var("OUT_DIR", "src/proto_codegen");
|
||||
|
||||
prost_build::compile_protos(
|
||||
&[
|
||||
// TODO: This needs to respect glob
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
/// Ingestion platforms are "dumb" and shouldn't have much logic in them.
|
||||
/// (Granted, we might eventually grow to send them back messages.)
|
||||
///
|
||||
/// The "enricher" is the smarts. It does denylisting, rate limiting,
|
||||
/// service calls, transforms, etc.
|
||||
///
|
||||
/// What if we need to scale? Several ideas: Sharding (redis db indices),
|
||||
/// brokers with read-once semantics (our own intelligence - UUIDs with
|
||||
/// transactional semantics in MySQL).
|
||||
///
|
||||
/// Events coming from multiple sources
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct PubsubEventPayloadV1 {
|
||||
/// Source of the event.
|
||||
#[prost(enumeration="pubsub_event_payload_v1::IngestionSourceType", optional, tag="1")]
|
||||
pub ingestion_source_type: ::core::option::Option<i32>,
|
||||
#[prost(enumeration="pubsub_event_payload_v1::IngestionPayloadType", optional, tag="2")]
|
||||
pub ingestion_payload_type: ::core::option::Option<i32>,
|
||||
/// A binary-encoded proto whose type is based on IngestionSourceType
|
||||
#[prost(bytes="vec", optional, tag="3")]
|
||||
pub ingestion_source_data: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
|
||||
/// A binary-encoded proto whose type is based on IngestionPayloadType
|
||||
#[prost(bytes="vec", optional, tag="4")]
|
||||
pub ingestion_payload_data: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
|
||||
/// An optional debug message.
|
||||
#[prost(string, optional, tag="5")]
|
||||
pub debug_message: ::core::option::Option<::prost::alloc::string::String>,
|
||||
}
|
||||
/// Nested message and enum types in `PubsubEventPayloadV1`.
|
||||
pub mod pubsub_event_payload_v1 {
|
||||
/// TODO: This should all be merged in the future, but I need to settle on proto2 vs proto3
|
||||
/// And I also need to figure out package names, etc.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
||||
#[repr(i32)]
|
||||
pub enum IngestionSourceType {
|
||||
IstDoNotUse = 0,
|
||||
IstAdminPanel = 1,
|
||||
IstVocodesWebsite = 2,
|
||||
IstTwitch = 3,
|
||||
IstTwitter = 4,
|
||||
IstDiscord = 5,
|
||||
IstYoutube = 6,
|
||||
IstReddit = 7,
|
||||
IstTiktok = 8,
|
||||
}
|
||||
/// These will differ from the "enriched" types.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
||||
#[repr(i32)]
|
||||
pub enum IngestionPayloadType {
|
||||
IptDoNotUse = 0,
|
||||
/// Twitch-specific events.
|
||||
///
|
||||
/// This can encode lots of things.
|
||||
TwitchMessage = 100,
|
||||
TwitchSubscribed = 101,
|
||||
/// Twitter-specific events.
|
||||
TwitterFollow = 200,
|
||||
TwitterRetweet = 201,
|
||||
TwitterMention = 202,
|
||||
/// Discord-specific events.
|
||||
DiscordMessage = 300,
|
||||
DiscordJoined = 301,
|
||||
/// YouTube-specific events.
|
||||
YoutubeSubscribed = 400,
|
||||
/// Reddit-specific events.
|
||||
RedditMessage = 500,
|
||||
}
|
||||
}
|
||||
// ============================== SOURCE PROTOS ============================== //
|
||||
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct IngestionTwitchMetadata {
|
||||
/// Optional. Fields describing the user that sent the message.
|
||||
#[prost(int64, optional, tag="1")]
|
||||
pub user_id: ::core::option::Option<i64>,
|
||||
#[prost(string, optional, tag="2")]
|
||||
pub username: ::core::option::Option<::prost::alloc::string::String>,
|
||||
#[prost(bool, optional, tag="3")]
|
||||
pub user_is_mod: ::core::option::Option<bool>,
|
||||
#[prost(bool, optional, tag="4")]
|
||||
pub user_is_subscribed: ::core::option::Option<bool>,
|
||||
/// Optional. Name of the channel, prefixed with hash. eg. `#vocodes`.
|
||||
#[prost(string, optional, tag="5")]
|
||||
pub channel: ::core::option::Option<::prost::alloc::string::String>,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct IngestionTwitterMetadata {
|
||||
/// Optional. Fields describing the user that sent the message.
|
||||
#[prost(string, optional, tag="1")]
|
||||
pub username: ::core::option::Option<::prost::alloc::string::String>,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct IngestionDiscordMetadata {
|
||||
/// Optional. Fields describing the user that sent the message.
|
||||
#[prost(string, optional, tag="1")]
|
||||
pub username: ::core::option::Option<::prost::alloc::string::String>,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct IngestionYoutubeMetadata {
|
||||
/// Optional. Fields describing the user that sent the message.
|
||||
#[prost(string, optional, tag="1")]
|
||||
pub username: ::core::option::Option<::prost::alloc::string::String>,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct IngestionRedditMetadata {
|
||||
/// Optional. Fields describing the user that sent the message.
|
||||
#[prost(string, optional, tag="1")]
|
||||
pub username: ::core::option::Option<::prost::alloc::string::String>,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct IngestionTikTokMetadata {
|
||||
/// Optional. Fields describing the user that sent the message.
|
||||
#[prost(string, optional, tag="1")]
|
||||
pub username: ::core::option::Option<::prost::alloc::string::String>,
|
||||
}
|
||||
// ============================== TWITCH PAYLOAD PROTOS ============================== //
|
||||
|
||||
/// These are raw messages from Twitch that we send to the PubSub enricher.
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct IngestionTwitchMessage {
|
||||
/// TODO: DEPRECATE THESE
|
||||
#[prost(int64, optional, tag="1")]
|
||||
pub user_id: ::core::option::Option<i64>,
|
||||
#[prost(string, optional, tag="2")]
|
||||
pub username: ::core::option::Option<::prost::alloc::string::String>,
|
||||
#[prost(bool, optional, tag="3")]
|
||||
pub is_mod: ::core::option::Option<bool>,
|
||||
#[prost(bool, optional, tag="4")]
|
||||
pub is_subscribed: ::core::option::Option<bool>,
|
||||
/// TODO: DEPRECATE THESE
|
||||
/// Name of the channel, prefixed with hash. eg. `#vocodes`.
|
||||
#[prost(string, optional, tag="5")]
|
||||
pub channel: ::core::option::Option<::prost::alloc::string::String>,
|
||||
/// Actual message. Doesn't need to be trimmed.
|
||||
#[prost(string, optional, tag="6")]
|
||||
pub message_contents: ::core::option::Option<::prost::alloc::string::String>,
|
||||
}
|
||||
/// Intentionally blank for now
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct IngestionTwitchSubscribed {
|
||||
}
|
||||
// ============================== TWITTER PAYLOAD PROTOS ============================== //
|
||||
|
||||
/// Intentionally blank for now
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct IngestionTwitterFollow {
|
||||
}
|
||||
/// Intentionally blank for now
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct IngestionTwitterRetweet {
|
||||
}
|
||||
/// Intentionally blank for now
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct IngestionTwitterMention {
|
||||
}
|
||||
// ============================== DISCORD PAYLOAD PROTOS ============================== //
|
||||
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct IngestionDiscordMessage {
|
||||
/// Raw message. Needs to be trimmed
|
||||
#[prost(string, optional, tag="6")]
|
||||
pub message_contents: ::core::option::Option<::prost::alloc::string::String>,
|
||||
}
|
||||
/// Intentionally blank for now
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct IngestionDiscordJoined {
|
||||
}
|
||||
// ============================== YOUTUBE PAYLOAD PROTOS ============================== //
|
||||
|
||||
/// Intentionally blank for now
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct IngestionYoutubeSubscribed {
|
||||
}
|
||||
// ============================== REDDIT PAYLOAD PROTOS ============================== //
|
||||
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct IngestionRedditMessage {
|
||||
/// Raw message. Needs to be trimmed
|
||||
#[prost(string, optional, tag="6")]
|
||||
pub message_contents: ::core::option::Option<::prost::alloc::string::String>,
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
/// The payloads delivered to unreal engine over the pubsub bus.
|
||||
/// These are the "enriched" events.
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct UnrealEventPayloadV1 {
|
||||
/// Source of the event.
|
||||
#[prost(enumeration="unreal_event_payload_v1::SourceType", tag="1")]
|
||||
pub source_type: i32,
|
||||
/// Type of the payload.
|
||||
#[prost(enumeration="unreal_event_payload_v1::PayloadType", tag="2")]
|
||||
pub payload_type: i32,
|
||||
/// A binary-encoded proto whose type is based on SourceType
|
||||
#[prost(bytes="vec", tag="3")]
|
||||
pub source_data: ::prost::alloc::vec::Vec<u8>,
|
||||
/// A binary-encoded proto whose type is based on PayloadType
|
||||
#[prost(bytes="vec", tag="4")]
|
||||
pub payload_data: ::prost::alloc::vec::Vec<u8>,
|
||||
/// An optional debug message.
|
||||
#[prost(string, tag="5")]
|
||||
pub debug_message: ::prost::alloc::string::String,
|
||||
}
|
||||
/// Nested message and enum types in `UnrealEventPayloadV1`.
|
||||
pub mod unreal_event_payload_v1 {
|
||||
/// If people Retweet us or mention us, we should show that in the engine!
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
||||
#[repr(i32)]
|
||||
pub enum SourceType {
|
||||
StDoNotUse = 0,
|
||||
StAdminPanel = 1,
|
||||
StVocodesWebsite = 2,
|
||||
StTwitch = 3,
|
||||
StTwitter = 4,
|
||||
StDiscord = 5,
|
||||
StYoutube = 6,
|
||||
StReddit = 7,
|
||||
StTiktok = 8,
|
||||
}
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
||||
#[repr(i32)]
|
||||
pub enum PayloadType {
|
||||
PtDoNotUse = 0,
|
||||
/// Game events. These can come from many sources (control panel, Twitch, Discord)
|
||||
VocodesTts = 1,
|
||||
LevelWarp = 2,
|
||||
CesiumWarp = 3,
|
||||
CesiumTimeChange = 4,
|
||||
///CHANGE_MUSIC = 6;
|
||||
SpawnCreature = 5,
|
||||
/// Twitter-specific events.
|
||||
TwitterFollow = 200,
|
||||
TwitterRetweet = 201,
|
||||
TwitterMention = 202,
|
||||
/// Discord-specific events.
|
||||
DiscordJoined = 300,
|
||||
/// YouTube-specific events.
|
||||
YoutubeSubscribed = 400,
|
||||
}
|
||||
}
|
||||
// ============================== SOURCE PROTOS ============================== //
|
||||
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct TwitchMetadata {
|
||||
/// Optional. Fields describing the user that sent the message.
|
||||
#[prost(int64, tag="1")]
|
||||
pub user_id: i64,
|
||||
#[prost(string, tag="2")]
|
||||
pub username: ::prost::alloc::string::String,
|
||||
#[prost(bool, tag="3")]
|
||||
pub user_is_mod: bool,
|
||||
#[prost(bool, tag="4")]
|
||||
pub user_is_subscribed: bool,
|
||||
/// Optional. Name of the channel, prefixed with hash. eg. `#vocodes`.
|
||||
#[prost(string, tag="5")]
|
||||
pub channel: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct TwitterMetadata {
|
||||
/// Optional. Fields describing the user that sent the message.
|
||||
#[prost(string, tag="1")]
|
||||
pub username: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct DiscordMetadata {
|
||||
/// Optional. Fields describing the user that sent the message.
|
||||
#[prost(string, tag="1")]
|
||||
pub username: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct YoutubeMetadata {
|
||||
/// Optional. Fields describing the user that sent the message.
|
||||
#[prost(string, tag="1")]
|
||||
pub username: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct RedditMetadata {
|
||||
/// Optional. Fields describing the user that sent the message.
|
||||
#[prost(string, tag="1")]
|
||||
pub username: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct TikTokMetadata {
|
||||
/// Optional. Fields describing the user that sent the message.
|
||||
#[prost(string, tag="1")]
|
||||
pub username: ::prost::alloc::string::String,
|
||||
}
|
||||
// ============================== GAME EVENT PROTOS ============================== //
|
||||
|
||||
/// Change time in Cesium.
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct CesiumTimeChangeRequest {
|
||||
/// Required
|
||||
#[prost(int64, tag="1")]
|
||||
pub hour: i64,
|
||||
}
|
||||
/// Warp within a Cesium geospatial world.
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct CesiumWarpRequest {
|
||||
/// Required
|
||||
#[prost(double, tag="1")]
|
||||
pub latitude: f64,
|
||||
/// Required
|
||||
#[prost(double, tag="2")]
|
||||
pub longitude: f64,
|
||||
/// TODO: Remove these.
|
||||
/// Optional. Fields describing the user that sent the message.
|
||||
#[prost(int64, tag="3")]
|
||||
pub twitch_user_id: i64,
|
||||
#[prost(string, tag="4")]
|
||||
pub twitch_username: ::prost::alloc::string::String,
|
||||
#[prost(bool, tag="5")]
|
||||
pub twitch_user_is_mod: bool,
|
||||
#[prost(bool, tag="6")]
|
||||
pub twitch_user_is_subscribed: bool,
|
||||
/// TODO: Remove these.
|
||||
/// Optional. Name of the channel, prefixed with hash. eg. `#vocodes`.
|
||||
#[prost(string, tag="7")]
|
||||
pub twitch_channel: ::prost::alloc::string::String,
|
||||
}
|
||||
/// Change the level
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct LevelWarpRequest {
|
||||
/// Required. Level to warp to.
|
||||
#[prost(string, tag="1")]
|
||||
pub level_slug: ::prost::alloc::string::String,
|
||||
}
|
||||
/// Spawn a creature
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct SpawnCreatureRequest {
|
||||
/// Required. Name of the creature.
|
||||
#[prost(int64, tag="1")]
|
||||
pub name_slug: i64,
|
||||
}
|
||||
/// Do text to speech
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct VocodesTtsRequest {
|
||||
/// Required. Speaker to use.
|
||||
#[prost(string, tag="1")]
|
||||
pub voice_slug: ::prost::alloc::string::String,
|
||||
/// Required. Text to speak.
|
||||
#[prost(double, tag="2")]
|
||||
pub text: f64,
|
||||
}
|
||||
// ============================== TWITTER EVENT PROTOS ============================== //
|
||||
|
||||
/// Intentionally blank
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct TwitterFollow {
|
||||
}
|
||||
/// Intentionally blank
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct TwitterRetweet {
|
||||
}
|
||||
/// Intentionally blank
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct TwitterMention {
|
||||
}
|
||||
// ============================== DISCORD EVENT PROTOS ============================== //
|
||||
|
||||
/// Intentionally blank
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct DiscordJoined {
|
||||
}
|
||||
// ============================== YOUTUBE EVENT PROTOS ============================== //
|
||||
|
||||
/// Intentionally blank
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct YoutubeSubscribed {
|
||||
}
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
// Include the protos
|
||||
pub mod protos {
|
||||
include!(concat!(env!("OUT_DIR"), "/storyteller.pubsub.rs"));
|
||||
include!(concat!(env!("OUT_DIR"), "/storyteller.unreal.rs"));
|
||||
include!("proto_codegen/storyteller.pubsub.rs");
|
||||
include!("proto_codegen/storyteller.unreal.rs");
|
||||
}
|
||||
Reference in new issue
Block a user