Commit Graph

561 Commits

Author SHA1 Message Date
Adam Simpkins
169f050b7f update HgBackingStore to track already imported commits
Summary:
Record mercurial commits that have been previously imported, and avoid
re-importing them when checking out a commit that was previously processed and
already has a tree present in the LocalStore.

Reviewed By: bolinfest

Differential Revision: D3416654

fbshipit-source-id: 80f70fa2204d3a2961991b634ad934a623b42b82
2016-06-13 15:16:30 -07:00
Adam Simpkins
6a9f974f31 add a generic LocalStore get() and put() methods
Summary:
Add APIs for storing arbitrary (key, value) data.

This will allow BackingStore implementations to store additional metadata, such
as mapping mercurial commit IDs to the eden root tree ID.

Eventually we may want to use RocksDB column families to partition the
different types of data being put into the LocalStore.  However, for now this
just uses a single key space.  We can add column family support in a separate
diff, if desired.

Reviewed By: bolinfest

Differential Revision: D3409866

fbshipit-source-id: 19a1d340b65bff2081981bf5daf32d5ad15b60c4
2016-06-13 15:16:30 -07:00
Adam Simpkins
eae8ee41e9 start adding an HgBackingStore implementation
Summary:
This adds an HgBackingStore implementation which can load tree data from a
mercurial repository.  Blob loading is not implemented yet, but will come in a
separate diff.

This also adds a minimal GitBackingStore class.  The GitBackingStore has nearly
no functionality, but is needed to keep the existing git functionality working.

Reviewed By: bolinfest

Differential Revision: D3409743

fbshipit-source-id: dbebf53e9de08bd1469e489baa48b84cbf889511
2016-06-13 15:16:30 -07:00
Adam Simpkins
d9be0757b8 add a BackingStore API
Summary:
Add the basic BackingStore interface, plus a NullBackingStore implementation
that always returns null.  This updates the ObjectStore to query the
BackingStore if data is not found in the LocalStore.

Additionally, this updates EdenServer to manage the BackingStore objects.  It
maintains a map of the BackingStore objects created for each known repository.

Reviewed By: bolinfest

Differential Revision: D3409602

fbshipit-source-id: 2920dc4c24ee1ec37efb542f058d0d121ceb5532
2016-06-13 15:16:29 -07:00
Adam Simpkins
e7a8605e0d update deserializeGitBlob() to accept an IOBuf
Summary:
Update deserializeGitBlob() to work on an IOBuf, rather than an rvalue
reference to a string.

The ugliness about having to wrap a std::string in a managed IOBuf is now
hidden inside the StoreResult class, rather than being something that the
GitBlob code has to know about.

Reviewed By: bolinfest

Differential Revision: D3403977

fbshipit-source-id: 0c58c019557050d6e201c1a462fa051c2526674a
2016-06-08 19:01:14 -07:00
Adam Simpkins
1b36d4bf83 add a StoreResult class
Summary:
Add a new StoreResult which wraps the std::string returned by RocksDB.

This replaces the std::unique<string> that LocalStore::get() used to return.
This lets us avoid a memory allocation.  StoreResult can also represent a "not
found" result, so that this case can be processed efficiently without having to
throw an exception.

Additionally, StoreResult is move-only so we can't ever unintentionally copy
the string data, which is potentially expensive.  It also provides APIs for
creating IOBuf wrappers, or moving the string to the heap so we can create an
managed IOBuf around it.

Reviewed By: bolinfest

Differential Revision: D3403958

fbshipit-source-id: ab0c304988a53eda50341ecc2f96ae5235e5260c
2016-06-08 19:01:13 -07:00
Adam Simpkins
32f4c458fe begin adding a new ObjectStore class
Summary:
Add a new ObjectStore class, which will eventually contain both a LocalStore
and a BackingStore.  The LocalStore will be a cache of data loaded from the
authoritative BackingStore.  The ObjectStore API will hide the work of querying
the BackingStore and updating the LocalStore when data is not already available
in the LocalStore.

For now ObjectStore only contains the LocalStore, but I will add BackingStore
functionality in subsequent diffs.  This diff simply updates all call sites to
use the ObjectStore instead of directly accessing the LocalStore.

Reviewed By: bolinfest

Differential Revision: D3403898

fbshipit-source-id: 47b8c51a7717a4c7c29911a7085b382521a8c0db
2016-06-08 19:01:13 -07:00
Adam Simpkins
96cea91e54 various minor efficiency improvements in LocalStore
Summary:
- Add a Sha1Key class that can more efficiently compute the key for
  file content SHA-1 values, without having to copy it into a new std::string
  object.  (In practice fbstring would have avoided having to actually allocate
  memory, but it was still an extra data copy.)

- The code was always converting the hash keys to hex on get and put
  operations, just in case it needed it if an error occurred.  This diff
  changes the code to only compute the hex value if an error actually occurred.

Reviewed By: bolinfest

Differential Revision: D3403889

fbshipit-source-id: 5abd8ef202cb00677a84a03a82e2a3d21f16cd2f
2016-06-08 14:54:01 -07:00
Adam Simpkins
c8ee028d3a display rocksdb key in hex if LocalStore::get() fails
Summary:
Use the hex-encoded version of the key in the RocksException if _get() fails,
rather than the raw binary data.

Reviewed By: bolinfest

Differential Revision: D3345355

fbshipit-source-id: cd8dc644a56ca3d5f3b9a9a0f5cc789b142f0bda
2016-05-24 22:14:14 -07:00
Facebook Github Bot 8
83f42a9fa6 Include build files that were inadvertently excluded from the initial export.
fbshipit-source-id: 2c76f0d5e55d84859ad9f4841cbe6994a62446f8
2016-05-12 16:08:34 -07:00
Facebook Github Bot 5
2eeea32117 Initial commit
fbshipit-source-id: 2bcefbd0cd127cc5ea982e074ea6819d7aac3d7a
2016-05-12 14:09:13 -07:00