forked from facebook/mcrouter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for imported IDLs, split out common parts of Memcache.idl
Summary: Add support for imported idls (in possibly different namespaces). Reviewed By: andreazevedo Differential Revision: D3793098 fbshipit-source-id: 3aabdd25c0784aa9e90e7e8d5ae14ee3041682ab
- Loading branch information
Showing
20 changed files
with
1,516 additions
and
1,161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace carbon::test; | ||
|
||
import "mcrouter/lib/carbon/test/a/b/B.idl" | ||
import "mcrouter/lib/carbon/test/b/B.idl" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace carbon::test2::util; | ||
|
||
enum SimpleEnum : int64_t { | ||
Twenty = 20, | ||
Zero = 0, | ||
One = 1, | ||
Negative = -92233 | ||
}; | ||
|
||
struct SimpleStruct { | ||
1: int64_t member1; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright (c) 2016, 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. | ||
* | ||
*/ | ||
|
||
/* | ||
* THIS FILE IS AUTOGENERATED. DO NOT MODIFY IT; ALL CHANGES WILL BE LOST IN | ||
* VAIN. | ||
* | ||
*/ | ||
|
||
namespace carbon { | ||
namespace test2 { | ||
namespace util { | ||
|
||
inline void SimpleStruct::serialize( | ||
carbon::CarbonProtocolWriter& writer) const { | ||
writer.writeStructBegin(); | ||
writer.writeInt64Field(1 /* field id */, member1()); | ||
writer.writeStructEnd(); | ||
writer.writeStop(); | ||
} | ||
|
||
inline void SimpleStruct::deserialize(carbon::CarbonProtocolReader& reader) { | ||
reader.readStructBegin(); | ||
while (true) { | ||
const auto pr = reader.readFieldHeader(); | ||
const auto fieldType = pr.first; | ||
const auto fieldId = pr.second; | ||
|
||
if (fieldType == carbon::FieldType::Stop) { | ||
break; | ||
} | ||
|
||
switch (fieldId) { | ||
case 1: { | ||
member1() = reader.readInt64Field(); | ||
break; | ||
} | ||
default: { | ||
reader.skip(fieldType); | ||
break; | ||
} | ||
} | ||
} | ||
reader.readStructEnd(); | ||
} | ||
|
||
} // util | ||
} // test2 | ||
} // carbon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* Copyright (c) 2016, 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. | ||
* | ||
*/ | ||
|
||
/* | ||
* THIS FILE IS AUTOGENERATED. DO NOT MODIFY IT; ALL CHANGES WILL BE LOST IN | ||
* VAIN. | ||
* | ||
*/ | ||
#pragma once | ||
|
||
#include <memory> | ||
#include <string> | ||
#include <utility> | ||
|
||
#include <folly/Optional.h> | ||
#include <folly/io/IOBuf.h> | ||
#include <mcrouter/lib/carbon/CarbonProtocolReader.h> | ||
#include <mcrouter/lib/carbon/CarbonProtocolWriter.h> | ||
#include <mcrouter/lib/carbon/CommonSerializationTraits.h> | ||
#include <mcrouter/lib/carbon/Keys.h> | ||
#include <mcrouter/lib/carbon/ReplyCommon.h> | ||
#include <mcrouter/lib/carbon/RequestCommon.h> | ||
#include <mcrouter/lib/carbon/RequestReplyUtil.h> | ||
#include <mcrouter/lib/carbon/Result.h> | ||
|
||
namespace carbon { | ||
namespace test2 { | ||
namespace util { | ||
|
||
enum class SimpleEnum : int64_t { | ||
Twenty = 20, | ||
Zero = 0, | ||
One = 1, | ||
Negative = -92233 | ||
}; | ||
|
||
class SimpleStruct { | ||
public: | ||
static constexpr bool hasExptime = false; | ||
static constexpr bool hasFlags = false; | ||
static constexpr bool hasKey = false; | ||
static constexpr bool hasValue = false; | ||
|
||
SimpleStruct() = default; | ||
SimpleStruct(const SimpleStruct&) = default; | ||
SimpleStruct& operator=(const SimpleStruct&) = default; | ||
SimpleStruct(SimpleStruct&&) = default; | ||
SimpleStruct& operator=(SimpleStruct&&) = default; | ||
|
||
int64_t member1() const { | ||
return member1_; | ||
} | ||
int64_t& member1() { | ||
return member1_; | ||
} | ||
uint64_t flags() const { | ||
return 0; | ||
} | ||
int32_t exptime() const { | ||
return 0; | ||
} | ||
|
||
void serialize(carbon::CarbonProtocolWriter& writer) const; | ||
|
||
void deserialize(carbon::CarbonProtocolReader& reader); | ||
|
||
private: | ||
int64_t member1_{0}; | ||
}; | ||
|
||
} // util | ||
} // test2 | ||
} // carbon | ||
|
||
#include "B-inl.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright (c) 2016, 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. | ||
* | ||
*/ | ||
|
||
/* | ||
* THIS FILE IS AUTOGENERATED. DO NOT MODIFY IT; ALL CHANGES WILL BE LOST IN | ||
* VAIN. | ||
* | ||
*/ | ||
|
||
namespace carbon { | ||
namespace test {} // test | ||
} // carbon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2016, 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. | ||
* | ||
*/ | ||
|
||
/* | ||
* THIS FILE IS AUTOGENERATED. DO NOT MODIFY IT; ALL CHANGES WILL BE LOST IN | ||
* VAIN. | ||
* | ||
*/ | ||
#pragma once | ||
|
||
#include <memory> | ||
#include <string> | ||
#include <utility> | ||
|
||
#include <folly/Optional.h> | ||
#include <folly/io/IOBuf.h> | ||
#include <mcrouter/lib/carbon/CarbonProtocolReader.h> | ||
#include <mcrouter/lib/carbon/CarbonProtocolWriter.h> | ||
#include <mcrouter/lib/carbon/CommonSerializationTraits.h> | ||
#include <mcrouter/lib/carbon/Keys.h> | ||
#include <mcrouter/lib/carbon/ReplyCommon.h> | ||
#include <mcrouter/lib/carbon/RequestCommon.h> | ||
#include <mcrouter/lib/carbon/RequestReplyUtil.h> | ||
#include <mcrouter/lib/carbon/Result.h> | ||
|
||
#include "mcrouter/lib/carbon/test/a/b/gen/B.h" | ||
#include "mcrouter/lib/carbon/test/b/gen/B.h" | ||
|
||
namespace carbon { | ||
namespace test {} // test | ||
} // carbon | ||
|
||
#include "A-inl.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace carbon::test; | ||
|
||
import "mcrouter/lib/carbon/test/a/b/B.idl" | ||
|
||
struct BaseStruct { | ||
1: int64_t baseInt64Member; | ||
}; | ||
|
||
struct SimpleStruct with 1: BaseStruct { | ||
1: int32_t int32Member; | ||
2: string stringMember; | ||
3: test2::util::SimpleEnum enumMember; | ||
4: vector<test2::util::SimpleStruct> vectorMember; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/* | ||
* Copyright (c) 2016, 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. | ||
* | ||
*/ | ||
|
||
/* | ||
* THIS FILE IS AUTOGENERATED. DO NOT MODIFY IT; ALL CHANGES WILL BE LOST IN | ||
* VAIN. | ||
* | ||
*/ | ||
|
||
namespace carbon { | ||
namespace test { | ||
|
||
inline void BaseStruct::serialize(carbon::CarbonProtocolWriter& writer) const { | ||
writer.writeStructBegin(); | ||
writer.writeInt64Field(1 /* field id */, baseInt64Member()); | ||
writer.writeStructEnd(); | ||
writer.writeStop(); | ||
} | ||
|
||
inline void BaseStruct::deserialize(carbon::CarbonProtocolReader& reader) { | ||
reader.readStructBegin(); | ||
while (true) { | ||
const auto pr = reader.readFieldHeader(); | ||
const auto fieldType = pr.first; | ||
const auto fieldId = pr.second; | ||
|
||
if (fieldType == carbon::FieldType::Stop) { | ||
break; | ||
} | ||
|
||
switch (fieldId) { | ||
case 1: { | ||
baseInt64Member() = reader.readInt64Field(); | ||
break; | ||
} | ||
default: { | ||
reader.skip(fieldType); | ||
break; | ||
} | ||
} | ||
} | ||
reader.readStructEnd(); | ||
} | ||
|
||
inline void SimpleStruct::serialize( | ||
carbon::CarbonProtocolWriter& writer) const { | ||
writer.writeStructBegin(); | ||
writer.writeInt32Field(1 /* field id */, int32Member()); | ||
writer.writeBinaryField(2 /* field id */, stringMember()); | ||
writer.writeInt64Field(3 /* field id */, static_cast<int64_t>(enumMember())); | ||
writer.writeVectorField<test2::util::SimpleStruct>( | ||
4 /* field id */, vectorMember()); | ||
writer.writeFieldHeader(carbon::FieldType::Struct, -1); | ||
_carbon_basestruct_.serialize(writer); | ||
writer.writeStructEnd(); | ||
writer.writeStop(); | ||
} | ||
|
||
inline void SimpleStruct::deserialize(carbon::CarbonProtocolReader& reader) { | ||
reader.readStructBegin(); | ||
while (true) { | ||
const auto pr = reader.readFieldHeader(); | ||
const auto fieldType = pr.first; | ||
const auto fieldId = pr.second; | ||
|
||
if (fieldType == carbon::FieldType::Stop) { | ||
break; | ||
} | ||
|
||
switch (fieldId) { | ||
case -1: { | ||
_carbon_basestruct_.deserialize(reader); | ||
break; | ||
} | ||
case 1: { | ||
int32Member() = reader.readInt32Field(); | ||
break; | ||
} | ||
case 2: { | ||
stringMember() = reader.readBinaryField<std::string>(); | ||
break; | ||
} | ||
case 3: { | ||
enumMember() = | ||
static_cast<test2::util::SimpleEnum>(reader.readInt64Field()); | ||
break; | ||
} | ||
case 4: { | ||
vectorMember() = reader.readVectorField<test2::util::SimpleStruct>(); | ||
break; | ||
} | ||
default: { | ||
reader.skip(fieldType); | ||
break; | ||
} | ||
} | ||
} | ||
reader.readStructEnd(); | ||
} | ||
|
||
} // test | ||
} // carbon |
Oops, something went wrong.