Struct libpijul::pristine::sanakirja::GenericTxn [−][src]
pub struct GenericTxn<T: LoadPage<Error = Error> + RootPage> { pub tree: Db_<PathId, Inode, Page<PathId, Inode>>, // some fields omitted }
Expand description
A transaction, used both for mutable and immutable transactions,
depending on type parameter T
.
In Sanakirja, both sanakirja::Txn
and sanakirja::MutTxn
implement sanakirja::Transaction
, explaining our implementation
of TxnT
for Txn<T>
for all T: sanakirja::Transaction
. This
covers both mutable and immutable transactions in a single
implementation.
Fields
tree: Db_<PathId, Inode, Page<PathId, Inode>>
Implementations
Trait Implementations
type RevChangeset = Db_<L64, Pair<ChangeId, SerializedMerkle>, Page<L64, Pair<ChangeId, SerializedMerkle>>>
fn get_changeset(
&self,
channel: &Self::Changeset,
c: &ChangeId
) -> Result<Option<&L64>, TxnErr<Self::GraphError>>
fn get_revchangeset(
&self,
revchanges: &Self::RevChangeset,
c: &L64
) -> Result<Option<&Pair<ChangeId, SerializedMerkle>>, TxnErr<Self::GraphError>>
type ChangesetCursor = Cursor<ChangeId, L64, Page<ChangeId, L64>>
fn cursor_changeset<'a>(
&'a self,
channel: &Self::Changeset,
pos: Option<ChangeId>
) -> Result<Cursor<Self, &'a Self, Self::ChangesetCursor, ChangeId, L64>, TxnErr<SanakirjaError>>
type RevchangesetCursor = Cursor<L64, Pair<ChangeId, SerializedMerkle>, Page<L64, Pair<ChangeId, SerializedMerkle>>>
fn cursor_revchangeset_ref<'a, RT: Deref<Target = Self>>(
txn: RT,
channel: &Self::RevChangeset,
pos: Option<L64>
) -> Result<Cursor<Self, RT, Self::RevchangesetCursor, L64, Pair<ChangeId, SerializedMerkle>>, TxnErr<SanakirjaError>>
fn rev_cursor_revchangeset<'a>(
&'a self,
channel: &Self::RevChangeset,
pos: Option<L64>
) -> Result<RevCursor<Self, &'a Self, Self::RevchangesetCursor, L64, Pair<ChangeId, SerializedMerkle>>, TxnErr<SanakirjaError>>
fn cursor_revchangeset_next(
&self,
cursor: &mut Self::RevchangesetCursor
) -> Result<Option<(&L64, &Pair<ChangeId, SerializedMerkle>)>, TxnErr<SanakirjaError>>
fn cursor_revchangeset_prev(
&self,
cursor: &mut Self::RevchangesetCursor
) -> Result<Option<(&L64, &Pair<ChangeId, SerializedMerkle>)>, TxnErr<SanakirjaError>>
fn cursor_changeset_next(
&self,
cursor: &mut Self::ChangesetCursor
) -> Result<Option<(&ChangeId, &L64)>, TxnErr<SanakirjaError>>
fn cursor_changeset_prev(
&self,
cursor: &mut Self::ChangesetCursor
) -> Result<Option<(&ChangeId, &L64)>, TxnErr<SanakirjaError>>
type States = Db_<SerializedMerkle, L64, Page<SerializedMerkle, L64>>
fn channel_has_state(
&self,
channel: &Self::States,
m: &SerializedMerkle
) -> Result<Option<L64>, TxnErr<Self::GraphError>>
type Tags = Db_<L64, SerializedHash, Page<L64, SerializedHash>>
type TagsCursor = Cursor<L64, SerializedHash, Page<L64, SerializedHash>>
type DepsError = SanakirjaError
type Dep = Db<ChangeId, ChangeId>
type Revdep = Db<ChangeId, ChangeId>
fn get_dep<'txn>(
&'txn self,
key: &ChangeId,
value: Option<&ChangeId>
) -> Result<Option<&'txn ChangeId>, TxnErr<Self::DepsError>>
fn get_revdep<'txn>(
&'txn self,
key: &ChangeId,
value: Option<&ChangeId>
) -> Result<Option<&'txn ChangeId>, TxnErr<Self::DepsError>>
type DepCursor = Cursor<ChangeId, ChangeId, Page<ChangeId, ChangeId>>
fn cursor_dep<'txn>(
&'txn self,
db: &Self::Dep,
pos: Option<(&ChangeId, Option<&ChangeId>)>
) -> Result<Cursor<Self, &'txn Self, Self::DepCursor, ChangeId, ChangeId>, TxnErr<SanakirjaError>>
fn cursor_dep_ref<RT: Deref<Target = Self>>(
txn: RT,
db: &Self::Dep,
pos: Option<(&ChangeId, Option<&ChangeId>)>
) -> Result<Cursor<Self, RT, Self::DepCursor, ChangeId, ChangeId>, TxnErr<SanakirjaError>>
fn cursor_dep_next<'txn>(
&'txn self,
cursor: &mut Self::DepCursor
) -> Result<Option<(&'txn ChangeId, &'txn ChangeId)>, TxnErr<SanakirjaError>>
fn cursor_dep_prev<'txn>(
&'txn self,
cursor: &mut Self::DepCursor
) -> Result<Option<(&'txn ChangeId, &'txn ChangeId)>, TxnErr<SanakirjaError>>
fn iter_dep_ref<RT: Deref<Target = Self> + Clone>(
txn: RT,
p: &ChangeId
) -> Result<Cursor<Self, RT, Self::DepCursor, ChangeId, ChangeId>, TxnErr<Self::DepsError>>
fn get_touched_files<'txn>(
&'txn self,
key: &Position<ChangeId>,
value: Option<&ChangeId>
) -> Result<Option<&'txn ChangeId>, TxnErr<Self::DepsError>>
fn get_rev_touched_files<'txn>(
&'txn self,
key: &ChangeId,
value: Option<&Position<ChangeId>>
) -> Result<Option<&'txn Position<ChangeId>>, TxnErr<Self::DepsError>>
type Touched_files = Db<Position<ChangeId>, ChangeId>
type Rev_touched_files = Db<ChangeId, Position<ChangeId>>
type Touched_filesCursor = Cursor<Position<ChangeId>, ChangeId, Page<Position<ChangeId>, ChangeId>>
fn cursor_touched_files<'txn>(
&'txn self,
db: &Self::Touched_files,
pos: Option<(&Position<ChangeId>, Option<&ChangeId>)>
) -> Result<Cursor<Self, &'txn Self, Self::Touched_filesCursor, Position<ChangeId>, ChangeId>, TxnErr<SanakirjaError>>
fn cursor_touched_files_next<'txn>(
&'txn self,
cursor: &mut Self::Touched_filesCursor
) -> Result<Option<(&'txn Position<ChangeId>, &'txn ChangeId)>, TxnErr<SanakirjaError>>
fn cursor_touched_files_prev<'txn>(
&'txn self,
cursor: &mut Self::Touched_filesCursor
) -> Result<Option<(&'txn Position<ChangeId>, &'txn ChangeId)>, TxnErr<SanakirjaError>>
fn iter_touched_files<'txn>(
&'txn self,
k: &Position<ChangeId>,
v: Option<&ChangeId>
) -> Result<Cursor<Self, &'txn Self, Self::Touched_filesCursor, Position<ChangeId>, ChangeId>, TxnErr<SanakirjaError>>
type Rev_touched_filesCursor = Cursor<ChangeId, Position<ChangeId>, Page<ChangeId, Position<ChangeId>>>
fn cursor_rev_touched_files<'txn>(
&'txn self,
db: &Self::Rev_touched_files,
pos: Option<(&ChangeId, Option<&Position<ChangeId>>)>
) -> Result<Cursor<Self, &'txn Self, Self::Rev_touched_filesCursor, ChangeId, Position<ChangeId>>, TxnErr<SanakirjaError>>
fn cursor_rev_touched_files_next<'txn>(
&'txn self,
cursor: &mut Self::Rev_touched_filesCursor
) -> Result<Option<(&'txn ChangeId, &'txn Position<ChangeId>)>, TxnErr<SanakirjaError>>
fn cursor_rev_touched_files_prev<'txn>(
&'txn self,
cursor: &mut Self::Rev_touched_filesCursor
) -> Result<Option<(&'txn ChangeId, &'txn Position<ChangeId>)>, TxnErr<SanakirjaError>>
fn iter_rev_touched_files<'txn>(
&'txn self,
k: &ChangeId,
v: Option<&Position<ChangeId>>
) -> Result<Cursor<Self, &'txn Self, Self::Rev_touched_filesCursor, ChangeId, Position<ChangeId>>, TxnErr<SanakirjaError>>
fn iter_revdep(
&self,
k: &ChangeId
) -> Result<Cursor<Self, &Self, Self::DepCursor, ChangeId, ChangeId>, TxnErr<Self::DepsError>>
fn iter_dep(
&self,
k: &ChangeId
) -> Result<Cursor<Self, &Self, Self::DepCursor, ChangeId, ChangeId>, TxnErr<Self::DepsError>>
fn iter_touched(
&self,
k: &Position<ChangeId>
) -> Result<Cursor<Self, &Self, Self::Touched_filesCursor, Position<ChangeId>, ChangeId>, TxnErr<Self::DepsError>>
fn iter_rev_touched(
&self,
k: &ChangeId
) -> Result<Cursor<Self, &Self, Self::Rev_touched_filesCursor, ChangeId, Position<ChangeId>>, TxnErr<Self::DepsError>>
type GraphCursor = Cursor<Vertex<ChangeId>, SerializedEdge, Page<Vertex<ChangeId>, SerializedEdge>>
fn iter_graph(
&self,
g: &Self::Graph,
s: Option<&Vertex<ChangeId>>
) -> Result<Self::GraphCursor, TxnErr<Self::GraphError>>
fn next_graph<'txn>(
&'txn self,
_: &Self::Graph,
a: &mut Self::GraphCursor
) -> Option<Result<(&'txn Vertex<ChangeId>, &'txn SerializedEdge), TxnErr<Self::GraphError>>>
type Graph = Db<Vertex<ChangeId>, SerializedEdge>
type GraphError = SanakirjaError
fn get_graph<'txn>(
&'txn self,
db: &Self::Graph,
key: &Vertex<ChangeId>,
value: Option<&SerializedEdge>
) -> Result<Option<&'txn SerializedEdge>, TxnErr<Self::GraphError>>
fn get_external(
&self,
p: &ChangeId
) -> Result<Option<&SerializedHash>, TxnErr<Self::GraphError>>
fn get_external(
&self,
p: &ChangeId
) -> Result<Option<&SerializedHash>, TxnErr<Self::GraphError>>
Returns the external hash of an internal change identifier, if the change is known. Read more
fn get_internal(
&self,
p: &SerializedHash
) -> Result<Option<&ChangeId>, TxnErr<Self::GraphError>>
fn get_internal(
&self,
p: &SerializedHash
) -> Result<Option<&ChangeId>, TxnErr<Self::GraphError>>
Returns the internal change identifier of change with external
hash hash
, if the change is known. Read more
fn init_adj(
&self,
g: &Self::Graph,
key: Vertex<ChangeId>,
dest: Position<ChangeId>,
min_flag: EdgeFlags,
max_flag: EdgeFlags
) -> Result<Self::Adj, TxnErr<Self::GraphError>>
fn next_adj<'a>(
&'a self,
_: &Self::Graph,
a: &mut Self::Adj
) -> Option<Result<&'a SerializedEdge, TxnErr<Self::GraphError>>>
fn find_block(
&self,
graph: &Self::Graph,
p: Position<ChangeId>
) -> Result<&Vertex<ChangeId>, BlockError<Self::GraphError>>
fn find_block_end(
&self,
graph: &Self::Graph,
p: Position<ChangeId>
) -> Result<&Vertex<ChangeId>, BlockError<Self::GraphError>>
type TreeError = SanakirjaError
fn get_inodes<'txn>(
&'txn self,
key: &Inode,
value: Option<&Position<ChangeId>>
) -> Result<Option<&'txn Position<ChangeId>>, TxnErr<Self::TreeError>>
fn get_revinodes<'txn>(
&'txn self,
key: &Position<ChangeId>,
value: Option<&Inode>
) -> Result<Option<&'txn Inode>, TxnErr<Self::TreeError>>
fn cursor_inodes<'txn>(
&'txn self,
db: &Self::Inodes,
pos: Option<(&Inode, Option<&Position<ChangeId>>)>
) -> Result<Cursor<Self, &'txn Self, Self::InodesCursor, Inode, Position<ChangeId>>, TxnErr<SanakirjaError>>
fn cursor_inodes_next<'txn>(
&'txn self,
cursor: &mut Self::InodesCursor
) -> Result<Option<(&'txn Inode, &'txn Position<ChangeId>)>, TxnErr<SanakirjaError>>
fn cursor_inodes_prev<'txn>(
&'txn self,
cursor: &mut Self::InodesCursor
) -> Result<Option<(&'txn Inode, &'txn Position<ChangeId>)>, TxnErr<SanakirjaError>>
fn cursor_revinodes<'txn>(
&'txn self,
db: &Self::Revinodes,
pos: Option<(&Position<ChangeId>, Option<&Inode>)>
) -> Result<Cursor<Self, &'txn Self, Self::RevinodesCursor, Position<ChangeId>, Inode>, TxnErr<SanakirjaError>>
fn cursor_revinodes_next<'txn>(
&'txn self,
cursor: &mut Self::RevinodesCursor
) -> Result<Option<(&'txn Position<ChangeId>, &'txn Inode)>, TxnErr<SanakirjaError>>
fn cursor_revinodes_prev<'txn>(
&'txn self,
cursor: &mut Self::RevinodesCursor
) -> Result<Option<(&'txn Position<ChangeId>, &'txn Inode)>, TxnErr<SanakirjaError>>
fn get_tree<'txn>(
&'txn self,
key: &PathId,
value: Option<&Inode>
) -> Result<Option<&'txn Inode>, TxnErr<Self::TreeError>>
type TreeCursor = Cursor<PathId, Inode, Page<PathId, Inode>>
fn cursor_tree<'txn>(
&'txn self,
db: &Self::Tree,
pos: Option<(&PathId, Option<&Inode>)>
) -> Result<Cursor<Self, &'txn Self, Self::TreeCursor, PathId, Inode>, TxnErr<SanakirjaError>>
fn cursor_tree_next<'txn>(
&'txn self,
cursor: &mut Self::TreeCursor
) -> Result<Option<(&'txn PathId, &'txn Inode)>, TxnErr<SanakirjaError>>
fn cursor_tree_prev<'txn>(
&'txn self,
cursor: &mut Self::TreeCursor
) -> Result<Option<(&'txn PathId, &'txn Inode)>, TxnErr<SanakirjaError>>
fn iter_tree<'txn>(
&'txn self,
k: &PathId,
v: Option<&Inode>
) -> Result<Cursor<Self, &'txn Self, Self::TreeCursor, PathId, Inode>, TxnErr<SanakirjaError>>
type RevtreeCursor = Cursor<Inode, PathId, Page<Inode, PathId>>
fn cursor_revtree<'txn>(
&'txn self,
db: &Self::Revtree,
pos: Option<(&Inode, Option<&PathId>)>
) -> Result<Cursor<Self, &'txn Self, Self::RevtreeCursor, Inode, PathId>, TxnErr<SanakirjaError>>
fn cursor_revtree_next<'txn>(
&'txn self,
cursor: &mut Self::RevtreeCursor
) -> Result<Option<(&'txn Inode, &'txn PathId)>, TxnErr<SanakirjaError>>
fn cursor_revtree_prev<'txn>(
&'txn self,
cursor: &mut Self::RevtreeCursor
) -> Result<Option<(&'txn Inode, &'txn PathId)>, TxnErr<SanakirjaError>>
fn iter_revtree<'txn>(
&'txn self,
k: &Inode,
v: Option<&PathId>
) -> Result<Cursor<Self, &'txn Self, Self::RevtreeCursor, Inode, PathId>, TxnErr<SanakirjaError>>
fn get_revtree<'txn>(
&'txn self,
key: &Inode,
value: Option<&PathId>
) -> Result<Option<&'txn PathId>, TxnErr<Self::TreeError>>
type PartialsCursor = Cursor<SmallStr, Position<ChangeId>, Page<SmallStr, Position<ChangeId>>>
fn cursor_partials<'txn>(
&'txn self,
db: &Self::Partials,
pos: Option<(&SmallStr, Option<&Position<ChangeId>>)>
) -> Result<Cursor<Self, &'txn Self, Self::PartialsCursor, SmallStr, Position<ChangeId>>, TxnErr<SanakirjaError>>
fn cursor_partials_next<'txn>(
&'txn self,
cursor: &mut Self::PartialsCursor
) -> Result<Option<(&'txn SmallStr, &'txn Position<ChangeId>)>, TxnErr<SanakirjaError>>
fn cursor_partials_prev<'txn>(
&'txn self,
cursor: &mut Self::PartialsCursor
) -> Result<Option<(&'txn SmallStr, &'txn Position<ChangeId>)>, TxnErr<SanakirjaError>>
type InodesCursor = Cursor<Inode, Position<ChangeId>, Page<Inode, Position<ChangeId>>>
fn iter_inodes(
&self
) -> Result<Cursor<Self, &Self, Self::InodesCursor, Inode, Position<ChangeId>>, TxnErr<Self::TreeError>>
type RevinodesCursor = Cursor<Position<ChangeId>, Inode, Page<Position<ChangeId>, Inode>>
fn iter_revinodes(
&self
) -> Result<Cursor<Self, &Self, Self::RevinodesCursor, Position<ChangeId>, Inode>, TxnErr<SanakirjaError>>
fn iter_partials<'txn>(
&'txn self,
k: &str
) -> Result<Cursor<Self, &'txn Self, Self::PartialsCursor, SmallStr, Position<ChangeId>>, TxnErr<SanakirjaError>>
fn hash_from_prefix(
&self,
s: &str
) -> Result<(Hash, ChangeId), HashPrefixError<Self::GraphError>>
fn hash_from_prefix_remote<'txn>(
&'txn self,
remote: &RemoteRef<Self>,
s: &str
) -> Result<Hash, HashPrefixError<Self::GraphError>>
fn load_channel(
&self,
name: &str
) -> Result<Option<ChannelRef<Self>>, TxnErr<Self::GraphError>>
fn load_remote(
&self,
name: &RemoteId
) -> Result<Option<RemoteRef<Self>>, TxnErr<Self::GraphError>>
type Channels = Db_<SmallStr, SerializedChannel, Page<SmallStr, SerializedChannel>>
type ChannelsCursor = Cursor<SmallStr, SerializedChannel, Page<SmallStr, SerializedChannel>>
fn cursor_channels<'txn>(
&'txn self,
db: &Self::Channels,
pos: Option<(&SmallStr, Option<&SerializedChannel>)>
) -> Result<Cursor<Self, &'txn Self, Self::ChannelsCursor, SmallStr, SerializedChannel>, TxnErr<SanakirjaError>>
fn cursor_channels_next<'txn>(
&'txn self,
cursor: &mut Self::ChannelsCursor
) -> Result<Option<(&'txn SmallStr, &'txn SerializedChannel)>, TxnErr<SanakirjaError>>
fn cursor_channels_prev<'txn>(
&'txn self,
cursor: &mut Self::ChannelsCursor
) -> Result<Option<(&'txn SmallStr, &'txn SerializedChannel)>, TxnErr<SanakirjaError>>
fn iter_channels<'txn>(
&'txn self,
start: &str
) -> Result<ChannelIterator<'txn, Self>, TxnErr<Self::GraphError>>
fn iter_channels<'txn>(
&'txn self,
start: &str
) -> Result<ChannelIterator<'txn, Self>, TxnErr<Self::GraphError>>
Iterate a function over all channels. The loop stops the first
time f
returns false
. Read more
type Remotes = Db_<RemoteId, SerializedRemote, Page<RemoteId, SerializedRemote>>
type RemotesCursor = Cursor<RemoteId, SerializedRemote, Page<RemoteId, SerializedRemote>>
fn cursor_remotes<'txn>(
&'txn self,
db: &Self::Remotes,
pos: Option<(&RemoteId, Option<&SerializedRemote>)>
) -> Result<Cursor<Self, &'txn Self, Self::RemotesCursor, RemoteId, SerializedRemote>, TxnErr<SanakirjaError>>
fn cursor_remotes_next<'txn>(
&'txn self,
cursor: &mut Self::RemotesCursor
) -> Result<Option<(&'txn RemoteId, &'txn SerializedRemote)>, TxnErr<SanakirjaError>>
fn cursor_remotes_prev<'txn>(
&'txn self,
cursor: &mut Self::RemotesCursor
) -> Result<Option<(&'txn RemoteId, &'txn SerializedRemote)>, TxnErr<SanakirjaError>>
fn iter_remotes<'txn>(
&'txn self,
start: &RemoteId
) -> Result<RemotesIterator<'txn, Self>, TxnErr<Self::GraphError>>
type Remote = Db_<L64, Pair<SerializedHash, SerializedMerkle>, Page<L64, Pair<SerializedHash, SerializedMerkle>>>
type Revremote = Db_<SerializedHash, L64, Page<SerializedHash, L64>>
type Remotestates = Db_<SerializedMerkle, L64, Page<SerializedMerkle, L64>>
type RemoteCursor = Cursor<L64, Pair<SerializedHash, SerializedMerkle>, Page<L64, Pair<SerializedHash, SerializedMerkle>>>
fn cursor_remote<'txn>(
&'txn self,
db: &Self::Remote,
pos: Option<(&L64, Option<&Pair<SerializedHash, SerializedMerkle>>)>
) -> Result<Cursor<Self, &'txn Self, Self::RemoteCursor, L64, Pair<SerializedHash, SerializedMerkle>>, TxnErr<SanakirjaError>>
fn cursor_remote_next<'txn>(
&'txn self,
cursor: &mut Self::RemoteCursor
) -> Result<Option<(&'txn L64, &'txn Pair<SerializedHash, SerializedMerkle>)>, TxnErr<SanakirjaError>>
fn cursor_remote_prev<'txn>(
&'txn self,
cursor: &mut Self::RemoteCursor
) -> Result<Option<(&'txn L64, &'txn Pair<SerializedHash, SerializedMerkle>)>, TxnErr<SanakirjaError>>
fn rev_cursor_remote<'txn>(
&'txn self,
db: &Self::Remote,
pos: Option<(&L64, Option<&Pair<SerializedHash, SerializedMerkle>>)>
) -> Result<RevCursor<Self, &'txn Self, Self::RemoteCursor, L64, Pair<SerializedHash, SerializedMerkle>>, TxnErr<SanakirjaError>>
fn iter_remote<'txn>(
&'txn self,
remote: &Self::Remote,
k: u64
) -> Result<Cursor<Self, &'txn Self, Self::RemoteCursor, L64, Pair<SerializedHash, SerializedMerkle>>, TxnErr<Self::GraphError>>
fn iter_rev_remote<'txn>(
&'txn self,
remote: &Self::Remote,
k: Option<L64>
) -> Result<RevCursor<Self, &'txn Self, Self::RemoteCursor, L64, Pair<SerializedHash, SerializedMerkle>>, TxnErr<Self::GraphError>>
fn get_remote(
&mut self,
name: RemoteId
) -> Result<Option<RemoteRef<Self>>, TxnErr<Self::GraphError>>
fn last_remote(
&self,
remote: &Self::Remote
) -> Result<Option<(u64, &Pair<SerializedHash, SerializedMerkle>)>, TxnErr<Self::GraphError>>
fn get_remote_state(
&self,
remote: &Self::Remote,
n: u64
) -> Result<Option<(u64, &Pair<SerializedHash, SerializedMerkle>)>, TxnErr<Self::GraphError>>
fn remote_has_change(
&self,
remote: &RemoteRef<Self>,
hash: &SerializedHash
) -> Result<bool, TxnErr<Self::GraphError>>
fn remote_has_state(
&self,
remote: &RemoteRef<Self>,
m: &SerializedMerkle
) -> Result<bool, TxnErr<Self::GraphError>>
This is actually safe because the only non-Send fields are
open_channels
and open_remotes
, but we can’t do anything with
a ChannelRef
whose transaction has been moved to another thread.