Skip to content

Commit

Permalink
Release v2.0.0-alpha.1
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega committed Mar 24, 2023
1 parent 02a181a commit 9c05f59
Show file tree
Hide file tree
Showing 22 changed files with 142 additions and 92 deletions.
62 changes: 62 additions & 0 deletions .github/e2e/gcp-pubsub-10-blocks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: ${TEST_NAME}
data:
daemon.toml: |-
[source]
type = "N2N"
address = ["Tcp", "relays-new.cardano-mainnet.iohk.io:3001"]
magic = "mainnet"
[source.finalize]
max_block_quantity = 10
[source.intersect]
type = "Point"
value = [50030552, "5a091e9831bc0fcd6e6bdb2877036bb260abb4e19195517e4153fb041f956df5"]
[sink]
type = "GcpPubSub"
topic = "oura-e2e"
---
apiVersion: batch/v1
kind: Job
metadata:
name: ${TEST_NAME}
labels:
app: ${TEST_NAME}
spec:
backoffLimit: 1
template:
metadata:
labels:
app: ${TEST_NAME}
spec:
restartPolicy: "Never"
serviceAccount: test
serviceAccountName: test
containers:
- name: main
image: ${TARGET_IMAGE}
env:
- name: "RUST_LOG"
value: "warn"
- name: ""
resources:
requests:
memory: 100Mi
cpu: 50m
limits:
memory: 500Mi
cpu: 200m
args:
- "daemon"
volumeMounts:
- mountPath: /etc/oura
name: oura-config
volumes:
- name: oura-config
configMap:
name: ${TEST_NAME}
12 changes: 12 additions & 0 deletions .github/e2e/teak-perigee-375701-90625f60f360.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"type": "service_account",
"project_id": "teak-perigee-375701",
"private_key_id": "90625f60f360ff18381e6b667fd974bf3ab3045f",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC8OcbP8PIt7sr/\njRzU9Dz5BjFijwnCk+hzYIWNueFpZNxunQrh9kOiqNAw2Js4ufxk89lm3ztAexwk\nEdBKwtbPn0696u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IOLsdUoDu0gRvNLI8FKTOJTDYSvgYPHeGxoB\ntv6HWcW7cF/ONHb3YUCrpwcHhDLvFB2sjfHjuZ6cIyanUWTBGyaaTiWc+QKBgHjj\n3J/mKeWaovnxlYz5zCaR4rl3ZhCY8ofEDaSTyEB0x2MYGNFZ+9L1JZVJucMt/tGs\nI5ic3VB20+fj5FXkaMf9C6vzwqenwUDIZ/HTPV27JGdWz9inIjPv+0P30s3ZGdec\ndscnd7qbRIX1QkCooPg5hGo9PVhbUb3b6167y0cBAoGBANXIgiDKc3moOJfI73t+\nuqZ55pBfiX8QaaTqSWdX+pNQemIp97UfW6vPG9gpsEZswUkwSNQjH5111ePLE0te\nK7dqqCuEMK7IIHGaMo48wZ8Et3tbWoLxpJu5iCaqCotxQ6ovUJAHPmb0ab42CxIV\n8vW11v5CXVCWa3f9YnMWfdqF\n-----END PRIVATE KEY-----\n",
"client_email": "[email protected]",
"client_id": "105764970135434041671",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/oura-e2e%40teak-perigee-375701.iam.gserviceaccount.com"
}
6 changes: 6 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ jobs:
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern=v{{major}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{version}}
- name: Login to DockerHub
uses: docker/login-action@v2
Expand Down Expand Up @@ -182,3 +187,4 @@ jobs:
with:
files: oura-*/oura-*
body_path: RELEASE.md
draft: true
21 changes: 2 additions & 19 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
command: test
args: --all-features

lints-rust:
lints:
name: Lint Rust
runs-on: ubuntu-latest
steps:
Expand All @@ -80,21 +80,4 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features -- -D warnings

lints-others:
name: Lint Support Files
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Check EditorConfig Compliance
uses: editorconfig-checker/action-editorconfig-checker@v1

lints:
name: Lint Rust & Support Files
runs-on: ubuntu-latest
needs: [lints-rust, lints-others]
steps:
- run: echo "All lints successful"
args: --all-features --all-targets -- -D warnings
11 changes: 10 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "oura"
description = "The tail of Cardano"
version = "1.8.1"
version = "2.0.0-alpha.1"
edition = "2021"
repository = "https://github.com/txpipe/oura"
homepage = "https://github.com/txpipe/oura"
Expand All @@ -13,8 +13,8 @@ authors = ["Santiago Carmuega <[email protected]>"]

[dependencies]
# pallas = "0.18.0"
# pallas = { git = "https://github.com/txpipe/pallas" }
pallas = { path = "../pallas/pallas" }
pallas = { git = "https://github.com/txpipe/pallas" }
# pallas = { path = "../pallas/pallas" }
# gasket = { path = "../../construkts/gasket-rs" }
gasket = { git = "https://github.com/construkts/gasket-rs.git" }
hex = "0.4.3"
Expand Down
18 changes: 6 additions & 12 deletions src/bin/oura/console.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,13 @@ use gasket::{metrics::Reading, runtime::Tether};
use lazy_static::{__Deref, lazy_static};
use log::Log;

#[derive(clap::ValueEnum, Clone)]
#[derive(clap::ValueEnum, Clone, Default)]
pub enum Mode {
/// shows progress as a plain sequence of logs
#[default]
Plain,
/// shows aggregated progress and metrics
TUI,
}

impl Default for Mode {
fn default() -> Self {
Mode::Plain
}
Tui,
}

struct TuiConsole {
Expand All @@ -39,8 +34,7 @@ impl TuiConsole {
indicatif::ProgressBar::new_spinner().with_style(
indicatif::ProgressStyle::default_spinner()
.template(&format!(
"{{spinner}} {:<20} {{msg:<20}} {{pos:>8}} | {{per_sec}}",
name
"{{spinner}} {name:<20} {{msg:<20}} {{pos:>8}} | {{per_sec}}"
))
.unwrap(),
),
Expand Down Expand Up @@ -195,7 +189,7 @@ lazy_static! {

pub fn initialize(mode: &Option<Mode>) {
match mode {
Some(Mode::TUI) => log::set_logger(TUI_CONSOLE.deref())
Some(Mode::Tui) => log::set_logger(TUI_CONSOLE.deref())
.map(|_| log::set_max_level(log::LevelFilter::Info))
.unwrap(),
_ => tracing::subscriber::set_global_default(
Expand All @@ -209,7 +203,7 @@ pub fn initialize(mode: &Option<Mode>) {

pub fn refresh<'a>(mode: &Option<Mode>, tethers: impl Iterator<Item = &'a Tether>) {
match mode {
Some(Mode::TUI) => TUI_CONSOLE.refresh(tethers),
Some(Mode::Tui) => TUI_CONSOLE.refresh(tethers),
_ => PLAIN_CONSOLE.refresh(tethers),
}
}
14 changes: 6 additions & 8 deletions src/bin/oura/daemon.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use clap;
use gasket::runtime::Tether;
use oura::{filters, framework::*, sinks, sources};
use pallas::{ledger::traverse::wellknown::GenesisValues, network::upstream::cursor::Cursor};
Expand Down Expand Up @@ -56,10 +55,9 @@ impl Runtime {

fn should_stop(&self) -> bool {
self.all_tethers().any(|tether| match tether.check_state() {
gasket::runtime::TetherState::Alive(x) => match x {
gasket::runtime::StageState::StandBy => true,
_ => false,
},
gasket::runtime::TetherState::Alive(x) => {
matches!(x, gasket::runtime::StageState::StandBy)
}
_ => true,
})
}
Expand Down Expand Up @@ -134,11 +132,11 @@ fn bootstrap(
pub fn run(args: &Args) -> Result<(), Error> {
console::initialize(&args.console);

let config = ConfigRoot::new(&args.config).map_err(|err| Error::config(err))?;
let config = ConfigRoot::new(&args.config).map_err(Error::config)?;

let chain = config.chain.unwrap_or_default().into();
let chain = config.chain.unwrap_or_default();
let cursor = Cursor::new(config.intersect.into());
let error_policy = config.policy.unwrap_or_default().into();
let error_policy = config.policy.unwrap_or_default();
let finalize = config.finalize;
let current_dir = std::env::current_dir().unwrap();

Expand Down
10 changes: 4 additions & 6 deletions src/filters/deno/mod.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
//! A mapper with custom logic from using the Deno runtime

use deno_core::{op, Extension, ModuleSpecifier, OpState, Snapshot};
use deno_core::{op, Extension, ModuleSpecifier, OpState};
use deno_runtime::permissions::PermissionsContainer;
use deno_runtime::worker::{MainWorker as DenoWorker, WorkerOptions};
use deno_runtime::BootstrapOptions;
use gasket::{messaging::*, runtime::Tether};
use serde::Deserialize;
use serde_json::json;
use std::ops::Deref;
use std::ops::DerefMut;
use std::path::PathBuf;
use tokio::runtime::Runtime as TokioRuntime;
use tracing::{debug, trace};
use tracing::trace;

use crate::framework::*;

Expand Down Expand Up @@ -151,7 +149,7 @@ impl gasket::runtime::Worker for Worker {
}
}
}
ChainEvent::Undo(p, r) => todo!(),
ChainEvent::Undo(..) => todo!(),
ChainEvent::Reset(p) => {
self.output.send(ChainEvent::reset(p))?;
}
Expand Down Expand Up @@ -189,7 +187,7 @@ pub struct Config {
}

impl Config {
pub fn bootstrapper(self, ctx: &Context) -> Result<Bootstrapper, Error> {
pub fn bootstrapper(self, _ctx: &Context) -> Result<Bootstrapper, Error> {
// let main_module =
// deno_core::resolve_path(&self.main_module,
// &ctx.current_dir).map_err(Error::config)?;
Expand Down
24 changes: 17 additions & 7 deletions src/filters/dsl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ impl Predicate {
}
}

#[derive(Default)]
struct Worker {
msg_count: gasket::metrics::Counter,
predicate: Predicate,
input: FilterInputPort,
output: FilterOutputPort,
}
Expand All @@ -231,9 +231,14 @@ impl gasket::runtime::Worker for Worker {
fn work(&mut self) -> gasket::runtime::WorkResult {
let msg = self.input.recv_or_idle()?;

todo!();

self.output.send(msg)?;
match &msg.payload {
ChainEvent::Apply(_, Record::OuraV1Event(x)) => {
if self.predicate.event_matches(x) {
self.output.send(msg)?;
}
}
_ => todo!(),
}

Ok(gasket::runtime::WorkOutcome::Partial)
}
Expand Down Expand Up @@ -263,12 +268,17 @@ impl Bootstrapper {

#[derive(Debug, Deserialize)]
pub struct Config {
pub check: Predicate,
pub predicate: Predicate,
}

impl Config {
pub fn bootstrapper(self, ctx: &Context) -> Result<Bootstrapper, Error> {
let worker = Worker::default();
pub fn bootstrapper(self, _ctx: &Context) -> Result<Bootstrapper, Error> {
let worker = Worker {
predicate: self.predicate,
msg_count: Default::default(),
input: Default::default(),
output: Default::default(),
};

Ok(Bootstrapper(worker))
}
Expand Down
Loading

0 comments on commit 9c05f59

Please sign in to comment.