Commit Graph

9 Commits

Author SHA1 Message Date
Mark Thomas
842e5de551 treedirstate: better iteration using visitor pattern
In order to allow the python interface code to perform actions on each node in
the tree without creating python-specific interfaces in the generic Rust code,
add a method of iterating over the tree, executing a closure at each file.

Use this to implement the methods that give iterators over the filenames in the
tree.  This performs better than the get_first/get_next-style iterators.

Differential Revision: https://phab.mercurial-scm.org/D1403
2017-11-28 04:51:38 -08:00
Mark Thomas
71fa542789 treedirstate: cache dirstate data when iterating all files
Iterations over all files will cause most of the file to be read in a piecemeal
fashion.  This will be inefficient on disks with slow seek times.   Instead,
read the whole file into memory before iterating.

Differential Revision: https://phab.mercurial-scm.org/D1402
2017-11-28 04:51:38 -08:00
Mark Thomas
92b2ce7563 treedirstate: add Python linkage
Adds a python module that uses the Rust treedirstate to replace the dirstate
map.

Differential Revision: https://phab.mercurial-scm.org/D1401
2017-11-28 04:51:38 -08:00
Mark Thomas
b0b8543136 treedirstate: add Dirstate
A Dirstate object links a Tree to an underlying Store and StoreView
implementation.

Differential Revision: https://phab.mercurial-scm.org/D1400
2017-11-28 04:51:38 -08:00
Mark Thomas
7bc6c8d231 treedirstate: add Tree
Adds Tree, an implementation of a dirstate tree.

Differential Revision: https://phab.mercurial-scm.org/D1399
2017-11-28 04:51:38 -08:00
Mark Thomas
5294b5f050 treedirstate: add FileStore
Adds FileStore, an implementation of the Store and StoreView traits that uses a
file on disk to store the data, and reads and writes blocks using file I/O.

Differential Revision: https://phab.mercurial-scm.org/D1398
2017-11-28 04:51:38 -08:00
Mark Thomas
1537d3833e treedirstate: add Store and StoreView traits
These traits represent abstract store objects than can store arbitrary data
blocks with store-generated indexes.

A NullStore implementation is provided which acts an always-empty StoreView.

Differential Revision: https://phab.mercurial-scm.org/D1397
2017-11-28 04:51:38 -08:00
Mark Thomas
5931d6cf5d treedirstate: add vecmap implementation
This adds an implementation of an ordered map that uses a vector pairs, sorted
by the key.

This is largely compatibly with std::collections::BTreeMap, but has performance
characteristics more suited for use in treedirstate.

Differential Revision: https://phab.mercurial-scm.org/D1396
2017-11-28 04:51:38 -08:00
Mark Thomas
21b68a9e17 treedirstate: create empty Rust project
Create an empty Rust project for treedirstate.  This will be a
re-implementation of the dirstate map using a tree structure, where nodes in
the tree are directories, and leaves are files.

Differential Revision: https://phab.mercurial-scm.org/D1395
2017-11-28 04:51:38 -08:00