Take ttl and backend from parameters
This commit is contained in:
@@ -369,6 +369,7 @@ pub struct CaConn {
|
||||
insert_item_send_fut: Option<async_channel::Send<'static, QueryItem>>,
|
||||
fut_get_series:
|
||||
FuturesOrdered<Pin<Box<dyn Future<Output = Result<(Cid, u32, u16, u16, Existence<SeriesId>), Error>> + Send>>>,
|
||||
backend: String,
|
||||
remote_addr_dbg: SocketAddrV4,
|
||||
local_epics_hostname: String,
|
||||
array_truncate: usize,
|
||||
@@ -387,6 +388,7 @@ pub struct CaConn {
|
||||
|
||||
impl CaConn {
|
||||
pub fn new(
|
||||
backend: String,
|
||||
remote_addr_dbg: SocketAddrV4,
|
||||
local_epics_hostname: String,
|
||||
data_store: Arc<DataStore>,
|
||||
@@ -412,6 +414,7 @@ impl CaConn {
|
||||
insert_item_sender,
|
||||
insert_item_send_fut: None,
|
||||
fut_get_series: FuturesOrdered::new(),
|
||||
backend,
|
||||
remote_addr_dbg,
|
||||
local_epics_hostname,
|
||||
array_truncate,
|
||||
@@ -730,6 +733,8 @@ impl CaConn {
|
||||
// TODO need last-save-ts for this state.
|
||||
}
|
||||
ChannelState::Created(st) => {
|
||||
// TODO if we don't wave a series id yet, dont' save? write-ampl.
|
||||
|
||||
let msp = info_store_msp_from_time(timenow.clone());
|
||||
if msp != st.info_store_msp_last {
|
||||
st.info_store_msp_last = msp;
|
||||
@@ -1243,7 +1248,7 @@ impl CaConn {
|
||||
&*(&self.data_store.chan_reg as &ChannelRegistry as *const ChannelRegistry)
|
||||
};
|
||||
let fut = z
|
||||
.get_series_id(cd)
|
||||
.get_series_id(cd, self.backend.clone())
|
||||
.map_ok(move |series| (cid, k.sid, k.data_type, k.data_count, series));
|
||||
// TODO throttle execution rate:
|
||||
self.fut_get_series.push_back(Box::pin(fut) as _);
|
||||
|
||||
@@ -82,6 +82,7 @@ impl CaConnSet {
|
||||
|
||||
pub async fn create_ca_conn(
|
||||
&self,
|
||||
backend: String,
|
||||
addr: SocketAddrV4,
|
||||
local_epics_hostname: String,
|
||||
array_truncate: usize,
|
||||
@@ -94,6 +95,7 @@ impl CaConnSet {
|
||||
info!("create new CaConn {:?}", addr);
|
||||
let addr2 = SocketAddr::V4(addr.clone());
|
||||
let mut conn = CaConn::new(
|
||||
backend.clone(),
|
||||
addr,
|
||||
local_epics_hostname,
|
||||
data_store.clone(),
|
||||
@@ -236,6 +238,7 @@ impl CaConnSet {
|
||||
|
||||
pub async fn add_channel_to_addr(
|
||||
&self,
|
||||
backend: String,
|
||||
addr: SocketAddr,
|
||||
channel_name: String,
|
||||
ingest_commons: Arc<IngestCommons>,
|
||||
@@ -263,6 +266,7 @@ impl CaConnSet {
|
||||
};
|
||||
// TODO use parameters:
|
||||
self.create_ca_conn(
|
||||
backend.clone(),
|
||||
addr,
|
||||
ingest_commons.local_epics_hostname.clone(),
|
||||
512,
|
||||
|
||||
@@ -47,7 +47,6 @@ async fn resolve_address(addr_str: &str) -> Result<SocketAddr, Error> {
|
||||
|
||||
pub async fn ca_search(opts: ListenFromFileOpts) -> Result<(), Error> {
|
||||
info!("ca_search begin");
|
||||
let facility = "scylla";
|
||||
let opts = parse_config(opts.config).await?;
|
||||
let d = Database {
|
||||
name: opts.pgconf.name.clone(),
|
||||
@@ -192,7 +191,7 @@ pub async fn ca_search(opts: ListenFromFileOpts) -> Result<(), Error> {
|
||||
pg_client
|
||||
.execute(
|
||||
&qu_insert,
|
||||
&[&facility, &item.channel, &queryaddr, &responseaddr, &addr],
|
||||
&[&opts.backend, &item.channel, &queryaddr, &responseaddr, &addr],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -35,8 +35,8 @@ impl ChannelRegistry {
|
||||
Self { pg_client }
|
||||
}
|
||||
|
||||
pub async fn get_series_id(&self, cd: ChannelDescDecoded) -> Result<Existence<SeriesId>, Error> {
|
||||
crate::series::get_series_id(&self.pg_client, &cd).await
|
||||
pub async fn get_series_id(&self, cd: ChannelDescDecoded, backend: String) -> Result<Existence<SeriesId>, Error> {
|
||||
crate::series::get_series_id(&self.pg_client, &cd, backend).await
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user