1

Thrift IDL でジェネリック データ型を設計する必要があります。同じことをレビューする専門家が必要です。

/**
 * wraper over various type declaration
 */
struct BoolType {
    1: required string name,
    2: required list<bool> val
}
struct ByteType {
    1: required string name,
    2: required list<byte> val
}
struct ShortType {
    1: required string name,
    2: required list<i16> val
}
struct IntType {
    1: required string name,
    2: required list<i32> val
}
struct LongType {
    1: required string name,
    2: required list<i64> val
}
struct DoubleType {
    1: required string name,
    2: required list<double> val
}
struct StringType {
    1: required string name,
    2: required list<string> val
}
struct BinaryType {
    1: required string name,
    2: required list<binary> val
}

union BasicType {
    1: BoolType        vBool,
    2: ByteType        vByte,
    3: IntType        vInt,
    4: LongType        vLong,
    5: DoubleType    vDouble,
    6: StringType    vString,
    7: BinaryType   vBinary
}

struct CompoundType {
    1: BoolType     vBool,
    2: ByteType        vByte,
    3: IntType        vInt,
    4: LongType        vLong,
    5: DoubleType    vDouble,
    6: StringType    vString,
    7: BinaryType   vBinary
}

union TObject {
    1: BasicType    vBasicType,
    2: CompoundType vCompoundType
}

TObjectサービス API で使用したいものです

4

1 に答える 1

-1

メーリングリストと同じ回答:

  1. 与えられた情報は、意味のあるレビューを行うのに十分ではありません
  2. 一般的なデータ構造は、不適切な API 設計の良い指標です。
于 2013-04-13T22:27:05.157 に答える