Rename parameters for consistency
This commit is contained in:
parent
ae8ec70e5e
commit
297d62d173
3 changed files with 16 additions and 16 deletions
|
|
@ -67,23 +67,23 @@ impl MsgStore<LogMsg> for Logger {
|
|||
Path::new(vec![*id])
|
||||
}
|
||||
|
||||
async fn tree(&self, root: &usize) -> Tree<LogMsg> {
|
||||
async fn tree(&self, tree_id: &usize) -> Tree<LogMsg> {
|
||||
let msgs = self
|
||||
.messages
|
||||
.lock()
|
||||
.get(*root)
|
||||
.get(*tree_id)
|
||||
.map(|msg| vec![msg.clone()])
|
||||
.unwrap_or_default();
|
||||
Tree::new(*root, msgs)
|
||||
Tree::new(*tree_id, msgs)
|
||||
}
|
||||
|
||||
async fn prev_tree_id(&self, tree: &usize) -> Option<usize> {
|
||||
tree.checked_sub(1)
|
||||
async fn prev_tree_id(&self, tree_id: &usize) -> Option<usize> {
|
||||
tree_id.checked_sub(1)
|
||||
}
|
||||
|
||||
async fn next_tree_id(&self, tree: &usize) -> Option<usize> {
|
||||
async fn next_tree_id(&self, tree_id: &usize) -> Option<usize> {
|
||||
let len = self.messages.lock().len();
|
||||
tree.checked_add(1).filter(|t| *t < len)
|
||||
tree_id.checked_add(1).filter(|t| *t < len)
|
||||
}
|
||||
|
||||
async fn first_tree_id(&self) -> Option<usize> {
|
||||
|
|
|
|||
|
|
@ -141,9 +141,9 @@ impl<M: Msg> Tree<M> {
|
|||
#[async_trait]
|
||||
pub trait MsgStore<M: Msg> {
|
||||
async fn path(&self, id: &M::Id) -> Path<M::Id>;
|
||||
async fn tree(&self, root: &M::Id) -> Tree<M>;
|
||||
async fn prev_tree_id(&self, tree: &M::Id) -> Option<M::Id>;
|
||||
async fn next_tree_id(&self, tree: &M::Id) -> Option<M::Id>;
|
||||
async fn tree(&self, tree_id: &M::Id) -> Tree<M>;
|
||||
async fn prev_tree_id(&self, tree_id: &M::Id) -> Option<M::Id>;
|
||||
async fn next_tree_id(&self, tree_id: &M::Id) -> Option<M::Id>;
|
||||
async fn first_tree_id(&self) -> Option<M::Id>;
|
||||
async fn last_tree_id(&self) -> Option<M::Id>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,36 +181,36 @@ impl MsgStore<EuphMsg> for EuphVault {
|
|||
rx.await.unwrap()
|
||||
}
|
||||
|
||||
async fn tree(&self, root: &Snowflake) -> Tree<EuphMsg> {
|
||||
async fn tree(&self, tree_id: &Snowflake) -> Tree<EuphMsg> {
|
||||
// TODO vault::Error
|
||||
let (tx, rx) = oneshot::channel();
|
||||
let request = EuphRequest::GetTree {
|
||||
room: self.room.clone(),
|
||||
root: *root,
|
||||
root: *tree_id,
|
||||
result: tx,
|
||||
};
|
||||
let _ = self.vault.tx.send(request.into());
|
||||
rx.await.unwrap()
|
||||
}
|
||||
|
||||
async fn prev_tree_id(&self, root: &Snowflake) -> Option<Snowflake> {
|
||||
async fn prev_tree_id(&self, tree_id: &Snowflake) -> Option<Snowflake> {
|
||||
// TODO vault::Error
|
||||
let (tx, rx) = oneshot::channel();
|
||||
let request = EuphRequest::GetPrevTreeId {
|
||||
room: self.room.clone(),
|
||||
root: *root,
|
||||
root: *tree_id,
|
||||
result: tx,
|
||||
};
|
||||
let _ = self.vault.tx.send(request.into());
|
||||
rx.await.unwrap()
|
||||
}
|
||||
|
||||
async fn next_tree_id(&self, root: &Snowflake) -> Option<Snowflake> {
|
||||
async fn next_tree_id(&self, tree_id: &Snowflake) -> Option<Snowflake> {
|
||||
// TODO vault::Error
|
||||
let (tx, rx) = oneshot::channel();
|
||||
let request = EuphRequest::GetNextTreeId {
|
||||
room: self.room.clone(),
|
||||
root: *root,
|
||||
root: *tree_id,
|
||||
result: tx,
|
||||
};
|
||||
let _ = self.vault.tx.send(request.into());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue