pub struct DieselAdminServiceStore<C: Connection + 'static> { /* private fields */ }Expand description
A database-backed AdminServiceStore, powered by Diesel.
Implementations
sourceimpl<C: Connection> DieselAdminServiceStore<C>
impl<C: Connection> DieselAdminServiceStore<C>
sourcepub fn new(connection_pool: Pool<ConnectionManager<C>>) -> Self
pub fn new(connection_pool: Pool<ConnectionManager<C>>) -> Self
sourcepub fn new_with_write_exclusivity(
connection_pool: Arc<RwLock<Pool<ConnectionManager<C>>>>
) -> Self
pub fn new_with_write_exclusivity(
connection_pool: Arc<RwLock<Pool<ConnectionManager<C>>>>
) -> Self
Create a new DieselAdminServiceStore with write exclusivity enabled.
Write exclusivity is enforced by providing a connection pool that is wrapped in a
RwLock. This ensures that there may be only one writer, but many readers.
Arguments
connection_pool: read-write lock-guarded connection pool for the database
Trait Implementations
sourceimpl AdminServiceStore for DieselAdminServiceStore<PgConnection>
impl AdminServiceStore for DieselAdminServiceStore<PgConnection>
sourcefn add_proposal(
&self,
proposal: CircuitProposal
) -> Result<(), AdminServiceStoreError>
fn add_proposal(
&self,
proposal: CircuitProposal
) -> Result<(), AdminServiceStoreError>
Adds a circuit proposal to the store Read more
sourcefn update_proposal(
&self,
proposal: CircuitProposal
) -> Result<(), AdminServiceStoreError>
fn update_proposal(
&self,
proposal: CircuitProposal
) -> Result<(), AdminServiceStoreError>
Updates a circuit proposal in the store Read more
sourcefn remove_proposal(
&self,
proposal_id: &str
) -> Result<(), AdminServiceStoreError>
fn remove_proposal(
&self,
proposal_id: &str
) -> Result<(), AdminServiceStoreError>
Removes a circuit proposal from the store Read more
sourcefn get_proposal(
&self,
proposal_id: &str
) -> Result<Option<CircuitProposal>, AdminServiceStoreError>
fn get_proposal(
&self,
proposal_id: &str
) -> Result<Option<CircuitProposal>, AdminServiceStoreError>
Fetches a circuit proposal from the store Read more
sourcefn list_proposals(
&self,
predicates: &[CircuitPredicate]
) -> Result<Box<dyn ExactSizeIterator<Item = CircuitProposal>>, AdminServiceStoreError>
fn list_proposals(
&self,
predicates: &[CircuitPredicate]
) -> Result<Box<dyn ExactSizeIterator<Item = CircuitProposal>>, AdminServiceStoreError>
List circuit proposals from the store Read more
sourcefn count_proposals(
&self,
predicates: &[CircuitPredicate]
) -> Result<u32, AdminServiceStoreError>
fn count_proposals(
&self,
predicates: &[CircuitPredicate]
) -> Result<u32, AdminServiceStoreError>
Returns the count of proposals in the store Read more
sourcefn add_circuit(
&self,
circuit: Circuit,
nodes: Vec<CircuitNode>
) -> Result<(), AdminServiceStoreError>
fn add_circuit(
&self,
circuit: Circuit,
nodes: Vec<CircuitNode>
) -> Result<(), AdminServiceStoreError>
Adds a circuit to the store along with the associated services and nodes Read more
sourcefn update_circuit(&self, circuit: Circuit) -> Result<(), AdminServiceStoreError>
fn update_circuit(&self, circuit: Circuit) -> Result<(), AdminServiceStoreError>
Updates a circuit in the store Read more
sourcefn remove_circuit(&self, circuit_id: &str) -> Result<(), AdminServiceStoreError>
fn remove_circuit(&self, circuit_id: &str) -> Result<(), AdminServiceStoreError>
Removes a circuit from the store Read more
sourcefn get_circuit(
&self,
circuit_id: &str
) -> Result<Option<Circuit>, AdminServiceStoreError>
fn get_circuit(
&self,
circuit_id: &str
) -> Result<Option<Circuit>, AdminServiceStoreError>
Fetches a circuit from the store Read more
sourcefn list_circuits(
&self,
predicates: &[CircuitPredicate]
) -> Result<Box<dyn ExactSizeIterator<Item = Circuit>>, AdminServiceStoreError>
fn list_circuits(
&self,
predicates: &[CircuitPredicate]
) -> Result<Box<dyn ExactSizeIterator<Item = Circuit>>, AdminServiceStoreError>
List all circuits from the store Read more
sourcefn count_circuits(
&self,
predicates: &[CircuitPredicate]
) -> Result<u32, AdminServiceStoreError>
fn count_circuits(
&self,
predicates: &[CircuitPredicate]
) -> Result<u32, AdminServiceStoreError>
Returns the count of circuits in the store Read more
sourcefn upgrade_proposal_to_circuit(
&self,
circuit_id: &str
) -> Result<(), AdminServiceStoreError>
fn upgrade_proposal_to_circuit(
&self,
circuit_id: &str
) -> Result<(), AdminServiceStoreError>
Adds a circuit, along with the associated services and nodes, to the store based on the proposal that is already in state. The associated circuit proposal for the circuit ID is also removed. Read more
sourcefn get_node(
&self,
node_id: &str
) -> Result<Option<CircuitNode>, AdminServiceStoreError>
fn get_node(
&self,
node_id: &str
) -> Result<Option<CircuitNode>, AdminServiceStoreError>
Fetches a node from the store Read more
sourcefn list_nodes(
&self
) -> Result<Box<dyn ExactSizeIterator<Item = CircuitNode>>, AdminServiceStoreError>
fn list_nodes(
&self
) -> Result<Box<dyn ExactSizeIterator<Item = CircuitNode>>, AdminServiceStoreError>
List all nodes from the store
sourcefn get_service(
&self,
service_id: &ServiceId
) -> Result<Option<Service>, AdminServiceStoreError>
fn get_service(
&self,
service_id: &ServiceId
) -> Result<Option<Service>, AdminServiceStoreError>
Fetches a service from the store Read more
sourcefn list_services(
&self,
circuit_id: &str
) -> Result<Box<dyn ExactSizeIterator<Item = Service>>, AdminServiceStoreError>
fn list_services(
&self,
circuit_id: &str
) -> Result<Box<dyn ExactSizeIterator<Item = Service>>, AdminServiceStoreError>
List all services in a specific circuit from the store Read more
sourcefn add_event(
&self,
event: AdminServiceEvent
) -> Result<AdminServiceEvent, AdminServiceStoreError>
fn add_event(
&self,
event: AdminServiceEvent
) -> Result<AdminServiceEvent, AdminServiceStoreError>
Add an event to the AdminServiceEventStore. Returns the recorded event index and
a copy of the event. Read more
sourcefn list_events_since(
&self,
start: i64
) -> Result<EventIter, AdminServiceStoreError>
fn list_events_since(
&self,
start: i64
) -> Result<EventIter, AdminServiceStoreError>
List AdminServiceEvents that have been added to the store since the provided index. Read more
sourcefn list_events_by_management_type_since(
&self,
management_type: String,
start: i64
) -> Result<EventIter, AdminServiceStoreError>
fn list_events_by_management_type_since(
&self,
management_type: String,
start: i64
) -> Result<EventIter, AdminServiceStoreError>
List AdminServiceEvents, with a corresponding CircuitProposal that has the specified
circuit_management_type, that have been added to the store since the provided index. Read more
fn clone_boxed(&self) -> Box<dyn AdminServiceStore>
sourceimpl AdminServiceStore for DieselAdminServiceStore<SqliteConnection>
impl AdminServiceStore for DieselAdminServiceStore<SqliteConnection>
sourcefn add_proposal(
&self,
proposal: CircuitProposal
) -> Result<(), AdminServiceStoreError>
fn add_proposal(
&self,
proposal: CircuitProposal
) -> Result<(), AdminServiceStoreError>
Adds a circuit proposal to the store Read more
sourcefn update_proposal(
&self,
proposal: CircuitProposal
) -> Result<(), AdminServiceStoreError>
fn update_proposal(
&self,
proposal: CircuitProposal
) -> Result<(), AdminServiceStoreError>
Updates a circuit proposal in the store Read more
sourcefn remove_proposal(
&self,
proposal_id: &str
) -> Result<(), AdminServiceStoreError>
fn remove_proposal(
&self,
proposal_id: &str
) -> Result<(), AdminServiceStoreError>
Removes a circuit proposal from the store Read more
sourcefn get_proposal(
&self,
proposal_id: &str
) -> Result<Option<CircuitProposal>, AdminServiceStoreError>
fn get_proposal(
&self,
proposal_id: &str
) -> Result<Option<CircuitProposal>, AdminServiceStoreError>
Fetches a circuit proposal from the store Read more
sourcefn list_proposals(
&self,
predicates: &[CircuitPredicate]
) -> Result<Box<dyn ExactSizeIterator<Item = CircuitProposal>>, AdminServiceStoreError>
fn list_proposals(
&self,
predicates: &[CircuitPredicate]
) -> Result<Box<dyn ExactSizeIterator<Item = CircuitProposal>>, AdminServiceStoreError>
List circuit proposals from the store Read more
sourcefn count_proposals(
&self,
predicates: &[CircuitPredicate]
) -> Result<u32, AdminServiceStoreError>
fn count_proposals(
&self,
predicates: &[CircuitPredicate]
) -> Result<u32, AdminServiceStoreError>
Returns the count of proposals in the store Read more
sourcefn add_circuit(
&self,
circuit: Circuit,
nodes: Vec<CircuitNode>
) -> Result<(), AdminServiceStoreError>
fn add_circuit(
&self,
circuit: Circuit,
nodes: Vec<CircuitNode>
) -> Result<(), AdminServiceStoreError>
Adds a circuit to the store along with the associated services and nodes Read more
sourcefn update_circuit(&self, circuit: Circuit) -> Result<(), AdminServiceStoreError>
fn update_circuit(&self, circuit: Circuit) -> Result<(), AdminServiceStoreError>
Updates a circuit in the store Read more
sourcefn remove_circuit(&self, circuit_id: &str) -> Result<(), AdminServiceStoreError>
fn remove_circuit(&self, circuit_id: &str) -> Result<(), AdminServiceStoreError>
Removes a circuit from the store Read more
sourcefn get_circuit(
&self,
circuit_id: &str
) -> Result<Option<Circuit>, AdminServiceStoreError>
fn get_circuit(
&self,
circuit_id: &str
) -> Result<Option<Circuit>, AdminServiceStoreError>
Fetches a circuit from the store Read more
sourcefn list_circuits(
&self,
predicates: &[CircuitPredicate]
) -> Result<Box<dyn ExactSizeIterator<Item = Circuit>>, AdminServiceStoreError>
fn list_circuits(
&self,
predicates: &[CircuitPredicate]
) -> Result<Box<dyn ExactSizeIterator<Item = Circuit>>, AdminServiceStoreError>
List all circuits from the store Read more
sourcefn count_circuits(
&self,
predicates: &[CircuitPredicate]
) -> Result<u32, AdminServiceStoreError>
fn count_circuits(
&self,
predicates: &[CircuitPredicate]
) -> Result<u32, AdminServiceStoreError>
Returns the count of circuits in the store Read more
sourcefn upgrade_proposal_to_circuit(
&self,
circuit_id: &str
) -> Result<(), AdminServiceStoreError>
fn upgrade_proposal_to_circuit(
&self,
circuit_id: &str
) -> Result<(), AdminServiceStoreError>
Adds a circuit, along with the associated services and nodes, to the store based on the proposal that is already in state. The associated circuit proposal for the circuit ID is also removed. Read more
sourcefn get_node(
&self,
node_id: &str
) -> Result<Option<CircuitNode>, AdminServiceStoreError>
fn get_node(
&self,
node_id: &str
) -> Result<Option<CircuitNode>, AdminServiceStoreError>
Fetches a node from the store Read more
sourcefn list_nodes(
&self
) -> Result<Box<dyn ExactSizeIterator<Item = CircuitNode>>, AdminServiceStoreError>
fn list_nodes(
&self
) -> Result<Box<dyn ExactSizeIterator<Item = CircuitNode>>, AdminServiceStoreError>
List all nodes from the store
sourcefn get_service(
&self,
service_id: &ServiceId
) -> Result<Option<Service>, AdminServiceStoreError>
fn get_service(
&self,
service_id: &ServiceId
) -> Result<Option<Service>, AdminServiceStoreError>
Fetches a service from the store Read more
sourcefn list_services(
&self,
circuit_id: &str
) -> Result<Box<dyn ExactSizeIterator<Item = Service>>, AdminServiceStoreError>
fn list_services(
&self,
circuit_id: &str
) -> Result<Box<dyn ExactSizeIterator<Item = Service>>, AdminServiceStoreError>
List all services in a specific circuit from the store Read more
sourcefn add_event(
&self,
event: AdminServiceEvent
) -> Result<AdminServiceEvent, AdminServiceStoreError>
fn add_event(
&self,
event: AdminServiceEvent
) -> Result<AdminServiceEvent, AdminServiceStoreError>
Add an event to the AdminServiceEventStore. Returns the recorded event index and
a copy of the event. Read more
sourcefn list_events_since(
&self,
start: i64
) -> Result<EventIter, AdminServiceStoreError>
fn list_events_since(
&self,
start: i64
) -> Result<EventIter, AdminServiceStoreError>
List AdminServiceEvents that have been added to the store since the provided index. Read more
sourcefn list_events_by_management_type_since(
&self,
management_type: String,
start: i64
) -> Result<EventIter, AdminServiceStoreError>
fn list_events_by_management_type_since(
&self,
management_type: String,
start: i64
) -> Result<EventIter, AdminServiceStoreError>
List AdminServiceEvents, with a corresponding CircuitProposal that has the specified
circuit_management_type, that have been added to the store since the provided index. Read more
fn clone_boxed(&self) -> Box<dyn AdminServiceStore>
sourceimpl Clone for DieselAdminServiceStore<PgConnection>
impl Clone for DieselAdminServiceStore<PgConnection>
Auto Trait Implementations
impl<C> !RefUnwindSafe for DieselAdminServiceStore<C>
impl<C> Send for DieselAdminServiceStore<C>
impl<C> Sync for DieselAdminServiceStore<C>
impl<C> Unpin for DieselAdminServiceStore<C>
impl<C> !UnwindSafe for DieselAdminServiceStore<C>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<P, N> IntoBytes<P> for N where
P: Message + FromNative<N>,
impl<P, N> IntoBytes<P> for N where
P: Message + FromNative<N>,
fn into_bytes(self) -> Result<Vec<u8, Global>, ProtoConversionError>
sourceimpl<N, P> IntoNative<N> for P where
N: FromProto<P>,
impl<N, P> IntoNative<N> for P where
N: FromProto<P>,
fn into_native(self) -> Result<N, ProtoConversionError>
sourceimpl<N, P> IntoProto<P> for N where
P: FromNative<N>,
impl<N, P> IntoProto<P> for N where
P: FromNative<N>,
fn into_proto(self) -> Result<P, ProtoConversionError>
sourceimpl<T> IntoSql for T
impl<T> IntoSql for T
sourcefn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
fn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
Convert self to an expression for Diesel’s query builder. Read more
sourcefn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
Convert &self to an expression for Diesel’s query builder. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more