|
@@ -87,7 +87,7 @@ impl RocksDb {
|
|
|
|
|
|
impl Storage for RocksDb {
|
|
impl Storage for RocksDb {
|
|
type Iterator<'a> = WrapperIterator<'a>;
|
|
type Iterator<'a> = WrapperIterator<'a>;
|
|
- fn get_local_events<'a>(&'a self, limit: Option<usize>) -> Result<WrapperIterator<'a>, Error> {
|
|
|
|
|
|
+ fn get_local_events(&self, limit: Option<usize>) -> Result<WrapperIterator<'_>, Error> {
|
|
let cf_handle = self.reference_to_cf_handle(ReferenceType::LocalEvents)?;
|
|
let cf_handle = self.reference_to_cf_handle(ReferenceType::LocalEvents)?;
|
|
Ok(WrapperIterator {
|
|
Ok(WrapperIterator {
|
|
db: self,
|
|
db: self,
|
|
@@ -106,8 +106,8 @@ impl Storage for RocksDb {
|
|
let secondary_index = SecondaryIndex::new(event_id, event.created_at());
|
|
let secondary_index = SecondaryIndex::new(event_id, event.created_at());
|
|
self.db.put_cf(
|
|
self.db.put_cf(
|
|
&self.reference_to_cf_handle(ReferenceType::LocalEvents)?,
|
|
&self.reference_to_cf_handle(ReferenceType::LocalEvents)?,
|
|
- secondary_index.index_by(&[]),
|
|
|
|
- &event_id.deref(),
|
|
|
|
|
|
+ secondary_index.index_by([]),
|
|
|
|
+ event_id.deref(),
|
|
)?;
|
|
)?;
|
|
Ok(())
|
|
Ok(())
|
|
}
|
|
}
|
|
@@ -125,7 +125,7 @@ impl Storage for RocksDb {
|
|
let author_id = secondary_index.index_by(event.author());
|
|
let author_id = secondary_index.index_by(event.author());
|
|
let json = serde_json::to_vec(event)?;
|
|
let json = serde_json::to_vec(event)?;
|
|
let kind: u32 = event.kind().into();
|
|
let kind: u32 = event.kind().into();
|
|
- let kind_id = secondary_index.index_by(&kind.to_be_bytes());
|
|
|
|
|
|
+ let kind_id = secondary_index.index_by(kind.to_be_bytes());
|
|
|
|
|
|
let mut buffer = WriteBatch::default();
|
|
let mut buffer = WriteBatch::default();
|
|
|
|
|
|
@@ -147,7 +147,7 @@ impl Storage for RocksDb {
|
|
|
|
|
|
buffer.put_cf(
|
|
buffer.put_cf(
|
|
&self.reference_to_cf_handle(ReferenceType::Stream)?,
|
|
&self.reference_to_cf_handle(ReferenceType::Stream)?,
|
|
- secondary_index.index_by(&[]),
|
|
|
|
|
|
+ secondary_index.index_by([]),
|
|
event_id.deref(),
|
|
event_id.deref(),
|
|
);
|
|
);
|
|
|
|
|
|
@@ -155,7 +155,7 @@ impl Storage for RocksDb {
|
|
match tag {
|
|
match tag {
|
|
Tag::PubKey(p) => {
|
|
Tag::PubKey(p) => {
|
|
let foreign_id = secondary_index.index_by(&p.id);
|
|
let foreign_id = secondary_index.index_by(&p.id);
|
|
- let local_id = secondary_index.index_by(&event_id);
|
|
|
|
|
|
+ let local_id = secondary_index.index_by(event_id);
|
|
|
|
|
|
buffer.put_cf(
|
|
buffer.put_cf(
|
|
&self.reference_to_cf_handle(ReferenceType::RefPublicKey)?,
|
|
&self.reference_to_cf_handle(ReferenceType::RefPublicKey)?,
|
|
@@ -170,7 +170,7 @@ impl Storage for RocksDb {
|
|
}
|
|
}
|
|
Tag::Event(e) => {
|
|
Tag::Event(e) => {
|
|
let foreign_id = secondary_index.index_by(&e.id);
|
|
let foreign_id = secondary_index.index_by(&e.id);
|
|
- let local_id = secondary_index.index_by(&event_id);
|
|
|
|
|
|
+ let local_id = secondary_index.index_by(event_id);
|
|
|
|
|
|
buffer.put_cf(
|
|
buffer.put_cf(
|
|
&self.reference_to_cf_handle(ReferenceType::RefEvent)?,
|
|
&self.reference_to_cf_handle(ReferenceType::RefEvent)?,
|
|
@@ -200,7 +200,7 @@ impl Storage for RocksDb {
|
|
.transpose()?)
|
|
.transpose()?)
|
|
}
|
|
}
|
|
|
|
|
|
- fn get_by_filter<'a>(&'a self, mut query: Filter) -> Result<WrapperIterator<'a>, Error> {
|
|
|
|
|
|
+ fn get_by_filter(&self, mut query: Filter) -> Result<WrapperIterator<'_>, Error> {
|
|
let limit = if query.limit == 0 {
|
|
let limit = if query.limit == 0 {
|
|
None
|
|
None
|
|
} else {
|
|
} else {
|