mirror of
https://github.com/facebook/sapling.git
synced 2024-10-12 01:39:21 +03:00
c12e300bb8
Summary: Move top-level Python packages `mercurial`, `hgext` and `hgdemandimport` to a new top-level package `edenscm`. This allows the Python packages provided by the upstream Mercurial to be installed side-by-side. To maintain compatibility, `edenscm/` gets added to `sys.path` in `mercurial/__init__.py`. Reviewed By: phillco, ikostia Differential Revision: D13853115 fbshipit-source-id: b296b0673dc54c61ef6a591ebc687057ff53b22e
77 lines
1.8 KiB
C++
77 lines
1.8 KiB
C++
// Copyright (c) 2004-present, Facebook, Inc.
|
|
// All Rights Reserved.
|
|
//
|
|
// This software may be used and distributed according to the terms of the
|
|
// GNU General Public License version 2 or any later version.
|
|
|
|
// uniondatapackstore.h - c++ declarations for a union datapack store
|
|
// no-check-code
|
|
|
|
#ifndef FBHGEXT_CSTORE_UNIONDATAPACKSTORE_H
|
|
#define FBHGEXT_CSTORE_UNIONDATAPACKSTORE_H
|
|
|
|
#include <cstring>
|
|
#include <stdexcept>
|
|
#include <vector>
|
|
|
|
extern "C" {
|
|
#include "lib/cdatapack/cdatapack.h"
|
|
}
|
|
|
|
#include "edenscm/hgext/extlib/cstore/datapackstore.h"
|
|
#include "edenscm/hgext/extlib/cstore/key.h"
|
|
#include "edenscm/hgext/extlib/cstore/store.h"
|
|
|
|
class UnionDatapackStore;
|
|
class UnionDatapackStoreKeyIterator : public KeyIterator {
|
|
private:
|
|
UnionDatapackStore& _store;
|
|
KeyIterator& _missing;
|
|
|
|
public:
|
|
UnionDatapackStoreKeyIterator(UnionDatapackStore& store, KeyIterator& missing)
|
|
: _store(store), _missing(missing) {}
|
|
|
|
Key* next() override;
|
|
};
|
|
|
|
class UnionDeltaChainIterator : public DeltaChainIterator {
|
|
private:
|
|
UnionDatapackStore& _store;
|
|
|
|
protected:
|
|
std::shared_ptr<DeltaChain> getNextChain(const Key& key) override;
|
|
|
|
public:
|
|
UnionDeltaChainIterator(UnionDatapackStore& store, const Key& key)
|
|
: DeltaChainIterator(), _store(store) {
|
|
_chains.push_back(this->getNextChain(key));
|
|
}
|
|
};
|
|
|
|
class UnionDatapackStore : public Store {
|
|
public:
|
|
std::vector<DataStore*> _stores;
|
|
|
|
UnionDatapackStore();
|
|
|
|
UnionDatapackStore(std::vector<DataStore*>& stores);
|
|
|
|
~UnionDatapackStore() override;
|
|
|
|
ConstantStringRef get(const Key& key) override;
|
|
|
|
UnionDeltaChainIterator getDeltaChain(const Key& key);
|
|
|
|
bool contains(const Key& key);
|
|
|
|
UnionDatapackStoreKeyIterator getMissing(KeyIterator& missing);
|
|
|
|
void markForRefresh();
|
|
|
|
void addStore(DataStore* store);
|
|
void removeStore(DataStore* store);
|
|
};
|
|
|
|
#endif // FBHGEXT_CSTORE_UNIONDATAPACKSTORE_H
|