sapling/cstore/uniondatapackstore.h
Jun Wu a72478f016 codemod: better #includes
Summary:
This patch removes all `#include "../` lines and use the shortest possible
include path.

Test Plan: `make clean build`

Reviewers: durham, #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5113672

Signature: t1:5113672:1495565454:961fb6f2f57a81a95013e0b8f67b2917c2e4523e
2017-05-23 11:57:32 -07:00

72 lines
1.6 KiB
C++

// uniondatapackstore.h - c++ declarations for a union datapack store
//
// Copyright 2017 Facebook, Inc.
//
// This software may be used and distributed according to the terms of the
// GNU General Public License version 2 or any later version.
//
// no-check-code
#ifndef UNIONDATAPACKSTORE_H
#define UNIONDATAPACKSTORE_H
extern "C" {
#include "cdatapack.h"
}
#include "key.h"
#include "datapackstore.h"
#include "store.h"
#include <cstring>
#include <vector>
#include <stdexcept>
class UnionDatapackStore;
class UnionDatapackStoreKeyIterator : public KeyIterator {
private:
UnionDatapackStore &_store;
KeyIterator &_missing;
public:
UnionDatapackStoreKeyIterator(UnionDatapackStore &store, KeyIterator &missing) :
_store(store),
_missing(missing) {}
Key *next();
};
class UnionDeltaChainIterator: public DeltaChainIterator {
private:
UnionDatapackStore &_store;
protected:
delta_chain_t getNextChain(const Key &key);
public:
UnionDeltaChainIterator(UnionDatapackStore &store, const Key &key) :
DeltaChainIterator(),
_store(store) {
_chains.push_back(this->getNextChain(key));
}
};
class UnionDatapackStore : public Store {
public:
std::vector<DatapackStore*> _stores;
UnionDatapackStore(std::vector<DatapackStore*> stores);
~UnionDatapackStore();
ConstantStringRef get(const Key &key);
UnionDeltaChainIterator getDeltaChain(const Key &key);
bool contains(const Key &key);
UnionDatapackStoreKeyIterator getMissing(KeyIterator &missing);
void markForRefresh();
};
#endif //UNIONDATAPACKSTORE_H