sapling/eden/fs/store/hg/HgBackingStore.h
Adam Simpkins 8893b0d694 use AbsolutePathPiece for repository path arguments
Summary:
Update HgBackingStore and GitBackingStore to accept the repository path as an
AbsolutePathPiece rather than as a plain StringPiece.

Reviewed By: bolinfest

Differential Revision: D5309172

fbshipit-source-id: aca4818c3add11d07ece796298f6175ca4fb1448
2017-06-23 15:23:32 -07:00

59 lines
1.8 KiB
C++

/*
* Copyright (c) 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
#pragma once
#include "eden/fs/store/BackingStore.h"
#include "eden/fs/store/hg/HgImporter.h"
#include "eden/fs/utils/PathFuncs.h"
#include <folly/Range.h>
#include <folly/Synchronized.h>
namespace facebook {
namespace eden {
class LocalStore;
/**
* A BackingStore implementation that loads data out of a mercurial repository.
*/
class HgBackingStore : public BackingStore {
public:
/**
* Create a new HgBackingStore.
*
* The LocalStore object is owned by the EdenServer (which also owns this
* HgBackingStore object). It is guaranteed to be valid for the lifetime of
* the HgBackingStore object.
*/
HgBackingStore(AbsolutePathPiece repository, LocalStore* localStore);
~HgBackingStore() override;
folly::Future<std::unique_ptr<Tree>> getTree(const Hash& id) override;
folly::Future<std::unique_ptr<Blob>> getBlob(const Hash& id) override;
folly::Future<std::unique_ptr<Tree>> getTreeForCommit(
const Hash& commitID) override;
private:
// Forbidden copy constructor and assignment operator
HgBackingStore(HgBackingStore const&) = delete;
HgBackingStore& operator=(HgBackingStore const&) = delete;
std::unique_ptr<Tree> getTreeForCommitImpl(const Hash& commitID);
// TODO: In the future we may want to maintain a pool of HgImporter objects,
// rather than just a single one, so we can perform multiple imports in
// parallel.
folly::Synchronized<HgImporter> importer_;
LocalStore* localStore_{nullptr};
};
}
} // facebook::eden