Add plugins directory

This commit is contained in:
William Brown 2018-12-28 15:33:09 +10:00
parent 34b29f3edd
commit 6bd5b8856b
6 changed files with 24 additions and 3 deletions

View file

@ -5,4 +5,8 @@ use rsidm::proto_v1;
fn main() { fn main() {
println!("Hello whoami"); println!("Hello whoami");
// Given the current ~/.rsidm/cookie (or none)
// we should check who we are plus show the auth token that the server
// would generate for us.
} }

View file

@ -1,4 +1,4 @@
use actix::SystemRunner; // use actix::SystemRunner;
use actix_web::{ use actix_web::{
error, http, middleware, App, AsyncResponder, Error, FutureResponse, HttpMessage, HttpRequest, error, http, middleware, App, AsyncResponder, Error, FutureResponse, HttpMessage, HttpRequest,
HttpResponse, Path, State, Result, HttpResponse, Path, State, Result,
@ -9,7 +9,10 @@ use bytes::BytesMut;
use futures::{future, Future, Stream}; use futures::{future, Future, Stream};
use super::config::Configuration; use super::config::Configuration;
use super::event::{CreateEvent, SearchEvent, SearchResult};
// SearchResult
use super::event::{CreateEvent, SearchEvent,
};
use super::filter::Filter; use super::filter::Filter;
use super::log; use super::log;
use super::proto_v1::{CreateRequest, Response, SearchRequest, SearchResponse}; use super::proto_v1::{CreateRequest, Response, SearchRequest, SearchResponse};

View file

@ -33,6 +33,7 @@ mod entry;
mod event; mod event;
mod schema; mod schema;
mod server; mod server;
mod plugins;
pub mod config; pub mod config;
pub mod core; pub mod core;

8
src/lib/plugins/mod.rs Normal file
View file

@ -0,0 +1,8 @@
mod uuid;
// We should define the order that plugins should run
// How do we deal with plugin activation? Config?
// What do plugins default to?

0
src/lib/plugins/uuid.rs Normal file
View file

View file

@ -3,12 +3,14 @@ use actix::prelude::*;
use audit::AuditScope; use audit::AuditScope;
use be::{Backend, BackendError}; use be::{Backend, BackendError};
use plugins;
use entry::Entry; use entry::Entry;
use error::OperationError; use error::OperationError;
use event::{CreateEvent, OpResult, SearchEvent, SearchResult}; use event::{CreateEvent, OpResult, SearchEvent, SearchResult};
use log::EventLog; use log::EventLog;
use schema::Schema; use schema::Schema;
pub fn start(log: actix::Addr<EventLog>, path: &str, threads: usize) -> actix::Addr<QueryServer> { pub fn start(log: actix::Addr<EventLog>, path: &str, threads: usize) -> actix::Addr<QueryServer> {
let mut audit = AuditScope::new("server_start"); let mut audit = AuditScope::new("server_start");
audit_segment!(audit, || { audit_segment!(audit, || {
@ -86,6 +88,9 @@ impl QueryServer {
// be handled by fe? // be handled by fe?
pub fn create(&mut self, au: &mut AuditScope, ce: &CreateEvent) -> Result<(), OperationError> { pub fn create(&mut self, au: &mut AuditScope, ce: &CreateEvent) -> Result<(), OperationError> {
// Start a txn // Start a txn
// run any pre plugins
// Run any pre checks // Run any pre checks
// FIXME: Normalise all entries incoming // FIXME: Normalise all entries incoming
@ -114,7 +119,7 @@ impl QueryServer {
}); });
au.append_scope(audit_be); au.append_scope(audit_be);
// Run and post checks // Run any post plugins
// Commit/Abort the txn // Commit/Abort the txn
res res
} }