mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
update vendor/ dir to latest w/o heroku, moby
had to lock a lot of things in place
This commit is contained in:
2
vendor/github.com/apache/thrift/Dockerfile
generated
vendored
2
vendor/github.com/apache/thrift/Dockerfile
generated
vendored
@@ -50,7 +50,7 @@ RUN buildDeps=" \
|
||||
/thrift \
|
||||
&& cmake --build . --config Release \
|
||||
&& make install \
|
||||
&& curl -k -sSL "https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz" -o /tmp/go.tar.gz \
|
||||
&& curl -k -sSL "https://storage.googleapis.com/golang/go1.5.2.linux-amd64.tar.gz" -o /tmp/go.tar.gz \
|
||||
&& tar xzf /tmp/go.tar.gz -C /tmp \
|
||||
&& cp /tmp/go/bin/gofmt /usr/bin/gofmt \
|
||||
&& apt-get purge -y --auto-remove $buildDeps \
|
||||
|
||||
2
vendor/github.com/apache/thrift/build/docker/centos/Dockerfile
generated
vendored
2
vendor/github.com/apache/thrift/build/docker/centos/Dockerfile
generated
vendored
@@ -102,7 +102,7 @@ RUN curl -sSL http://packages.erlang-solutions.com/rpm/centos/erlang_solutions.r
|
||||
erlang-tools
|
||||
|
||||
# Go Dependencies
|
||||
RUN curl -sSL https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz | tar -C /usr/local/ -xz
|
||||
RUN curl -sSL https://storage.googleapis.com/golang/go1.4.3.linux-amd64.tar.gz | tar -C /usr/local/ -xz
|
||||
ENV PATH /usr/local/go/bin:$PATH
|
||||
|
||||
# Haskell Dependencies
|
||||
|
||||
2
vendor/github.com/apache/thrift/build/docker/debian/Dockerfile
generated
vendored
2
vendor/github.com/apache/thrift/build/docker/debian/Dockerfile
generated
vendored
@@ -155,7 +155,7 @@ RUN pip2 install -U ipaddress backports.ssl_match_hostname tornado
|
||||
RUN pip3 install -U backports.ssl_match_hostname tornado
|
||||
|
||||
# Go
|
||||
RUN curl -sSL https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz | tar -C /usr/local/ -xz
|
||||
RUN curl -sSL https://storage.googleapis.com/golang/go1.4.3.linux-amd64.tar.gz | tar -C /usr/local/ -xz
|
||||
ENV PATH /usr/local/go/bin:$PATH
|
||||
|
||||
# Haxe
|
||||
|
||||
2
vendor/github.com/apache/thrift/build/docker/ubuntu/Dockerfile
generated
vendored
2
vendor/github.com/apache/thrift/build/docker/ubuntu/Dockerfile
generated
vendored
@@ -177,7 +177,7 @@ RUN pip2 install -U ipaddress backports.ssl_match_hostname tornado
|
||||
RUN pip3 install -U backports.ssl_match_hostname tornado
|
||||
|
||||
# Go
|
||||
RUN curl -sSL https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz | tar -C /usr/local/ -xz
|
||||
RUN curl -sSL https://storage.googleapis.com/golang/go1.4.3.linux-amd64.tar.gz | tar -C /usr/local/ -xz
|
||||
ENV PATH /usr/local/go/bin:$PATH
|
||||
|
||||
# Haxe
|
||||
|
||||
180
vendor/github.com/apache/thrift/compiler/cpp/src/thrift/generate/t_erl_generator.cc
generated
vendored
180
vendor/github.com/apache/thrift/compiler/cpp/src/thrift/generate/t_erl_generator.cc
generated
vendored
@@ -118,6 +118,8 @@ public:
|
||||
void generate_type_metadata(std::string function_name, vector<string> names);
|
||||
void generate_enum_info(t_enum* tenum);
|
||||
void generate_enum_metadata();
|
||||
void generate_const_function(t_const* tconst, ostringstream& exports, ostringstream& functions);
|
||||
void generate_const_functions();
|
||||
|
||||
/**
|
||||
* Service-level generation functions
|
||||
@@ -136,6 +138,7 @@ public:
|
||||
std::string erl_imports();
|
||||
std::string render_includes();
|
||||
std::string type_name(t_type* ttype);
|
||||
std::string render_const_list_values(t_type* type, t_const_value* value);
|
||||
|
||||
std::string function_signature(t_function* tfunction, std::string prefix = "");
|
||||
|
||||
@@ -188,7 +191,6 @@ private:
|
||||
void export_function(t_function* tfunction, std::string prefix = "");
|
||||
void export_string(std::string name, int num);
|
||||
|
||||
void export_types_function(t_function* tfunction, std::string prefix = "");
|
||||
void export_types_string(std::string name, int num);
|
||||
|
||||
/**
|
||||
@@ -218,7 +220,9 @@ private:
|
||||
std::ofstream f_types_file_;
|
||||
std::ofstream f_types_hrl_file_;
|
||||
|
||||
std::ofstream f_consts_;
|
||||
std::ofstream f_consts_file_;
|
||||
std::ofstream f_consts_hrl_file_;
|
||||
|
||||
std::ostringstream f_service_;
|
||||
std::ofstream f_service_file_;
|
||||
std::ofstream f_service_hrl_;
|
||||
@@ -230,6 +234,7 @@ private:
|
||||
std::vector<std::string> v_enum_names_;
|
||||
std::vector<std::string> v_exception_names_;
|
||||
std::vector<t_enum*> v_enums_;
|
||||
std::vector<t_const*> v_consts_;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -246,31 +251,41 @@ void t_erl_generator::init_generator() {
|
||||
export_lines_first_ = true;
|
||||
export_types_lines_first_ = true;
|
||||
|
||||
string program_module_name = make_safe_for_module_name(program_name_);
|
||||
|
||||
// types files
|
||||
string f_types_name = get_out_dir() + make_safe_for_module_name(program_name_) + "_types.erl";
|
||||
string f_types_hrl_name = get_out_dir() + make_safe_for_module_name(program_name_) + "_types.hrl";
|
||||
string f_types_name = get_out_dir() + program_module_name + "_types.erl";
|
||||
string f_types_hrl_name = get_out_dir() + program_module_name + "_types.hrl";
|
||||
|
||||
f_types_file_.open(f_types_name.c_str());
|
||||
f_types_hrl_file_.open(f_types_hrl_name.c_str());
|
||||
|
||||
hrl_header(f_types_hrl_file_, make_safe_for_module_name(program_name_) + "_types");
|
||||
hrl_header(f_types_hrl_file_, program_module_name + "_types");
|
||||
|
||||
f_types_file_ << erl_autogen_comment() << endl << "-module("
|
||||
<< make_safe_for_module_name(program_name_) << "_types)." << endl << erl_imports()
|
||||
f_types_file_ << erl_autogen_comment() << endl
|
||||
<< "-module(" << program_module_name << "_types)." << endl
|
||||
<< erl_imports() << endl;
|
||||
|
||||
f_types_file_ << "-include(\"" << f_types_hrl_name << "\")." << endl
|
||||
<< endl;
|
||||
|
||||
f_types_file_ << "-include(\"" << make_safe_for_module_name(program_name_) << "_types.hrl\")."
|
||||
<< endl << endl;
|
||||
|
||||
f_types_hrl_file_ << render_includes() << endl;
|
||||
|
||||
// consts file
|
||||
string f_consts_name = get_out_dir() + make_safe_for_module_name(program_name_)
|
||||
+ "_constants.hrl";
|
||||
f_consts_.open(f_consts_name.c_str());
|
||||
// consts files
|
||||
string f_consts_name = get_out_dir() + program_module_name + "_constants.erl";
|
||||
string f_consts_hrl_name = get_out_dir() + program_module_name + "_constants.hrl";
|
||||
|
||||
f_consts_ << erl_autogen_comment() << endl << erl_imports() << endl << "-include(\""
|
||||
<< make_safe_for_module_name(program_name_) << "_types.hrl\")." << endl << endl;
|
||||
f_consts_file_.open(f_consts_name.c_str());
|
||||
f_consts_hrl_file_.open(f_consts_hrl_name.c_str());
|
||||
|
||||
f_consts_file_ << erl_autogen_comment() << endl
|
||||
<< "-module(" << program_module_name << "_constants)." << endl
|
||||
<< erl_imports() << endl
|
||||
<< "-include(\"" << f_types_hrl_name << "\")." << endl
|
||||
<< endl;
|
||||
|
||||
f_consts_hrl_file_ << erl_autogen_comment() << endl << erl_imports() << endl
|
||||
<< "-include(\"" << f_types_hrl_name << "\")." << endl << endl;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -351,6 +366,8 @@ void t_erl_generator::close_generator() {
|
||||
f_types_file_ << f_info_ext_.str();
|
||||
f_types_file_ << "struct_info_ext(_) -> erlang:error(function_clause)." << endl << endl;
|
||||
|
||||
generate_const_functions();
|
||||
|
||||
generate_type_metadata("struct_names", v_struct_names_);
|
||||
generate_enum_metadata();
|
||||
generate_type_metadata("enum_names", v_enum_names_);
|
||||
@@ -360,7 +377,8 @@ void t_erl_generator::close_generator() {
|
||||
|
||||
f_types_file_.close();
|
||||
f_types_hrl_file_.close();
|
||||
f_consts_.close();
|
||||
f_consts_file_.close();
|
||||
f_consts_hrl_file_.close();
|
||||
}
|
||||
|
||||
void t_erl_generator::generate_type_metadata(std::string function_name, vector<string> names) {
|
||||
@@ -393,6 +411,68 @@ void t_erl_generator::generate_typedef(t_typedef* ttypedef) {
|
||||
(void)ttypedef;
|
||||
}
|
||||
|
||||
|
||||
void t_erl_generator::generate_const_function(t_const* tconst, ostringstream& exports, ostringstream& functions) {
|
||||
t_type* type = get_true_type(tconst->get_type());
|
||||
string name = tconst->get_name();
|
||||
t_const_value* value = tconst->get_value();
|
||||
|
||||
if (type->is_map()) {
|
||||
t_type* ktype = ((t_map*)type)->get_key_type();
|
||||
t_type* vtype = ((t_map*)type)->get_val_type();
|
||||
string const_fun_name = lowercase(name);
|
||||
|
||||
// Emit const function export.
|
||||
if (exports.tellp() > 0) { exports << ", "; }
|
||||
exports << const_fun_name << "/1, " << const_fun_name << "/2";
|
||||
|
||||
// Emit const function definition.
|
||||
map<t_const_value*, t_const_value*>::const_iterator i, end = value->get_map().end();
|
||||
// The one-argument form throws an error if the key does not exist in the map.
|
||||
for (i = value->get_map().begin(); i != end;) {
|
||||
functions << const_fun_name << "(" << render_const_value(ktype, i->first) << ") -> "
|
||||
<< render_const_value(vtype, i->second);
|
||||
++i;
|
||||
functions << (i != end ? ";\n" : ".\n\n");
|
||||
}
|
||||
|
||||
// The two-argument form returns a default value if the key does not exist in the map.
|
||||
for (i = value->get_map().begin(); i != end; ++i) {
|
||||
functions << const_fun_name << "(" << render_const_value(ktype, i->first) << ", _) -> "
|
||||
<< render_const_value(vtype, i->second) << ";\n";
|
||||
}
|
||||
functions << const_fun_name << "(_, Default) -> Default.\n\n";
|
||||
} else if (type->is_list()) {
|
||||
string const_fun_name = lowercase(name);
|
||||
|
||||
if (exports.tellp() > 0) { exports << ", "; }
|
||||
exports << const_fun_name << "/1, " << const_fun_name << "/2";
|
||||
|
||||
size_t list_size = value->get_list().size();
|
||||
string rendered_list = render_const_list_values(type, value);
|
||||
functions << const_fun_name << "(N) when N >= 1, N =< " << list_size << " ->\n"
|
||||
<< indent_str() << "element(N, {" << rendered_list << "}).\n";
|
||||
functions << const_fun_name << "(N, _) when N >= 1, N =< " << list_size << " ->\n"
|
||||
<< indent_str() << "element(N, {" << rendered_list << "});\n"
|
||||
<< const_fun_name << "(_, Default) -> Default.\n\n";
|
||||
indent_down();
|
||||
}
|
||||
}
|
||||
|
||||
void t_erl_generator::generate_const_functions() {
|
||||
ostringstream exports;
|
||||
ostringstream functions;
|
||||
vector<t_const*>::iterator c_iter;
|
||||
for (c_iter = v_consts_.begin(); c_iter != v_consts_.end(); ++c_iter) {
|
||||
generate_const_function(*c_iter, exports, functions);
|
||||
}
|
||||
if (exports.tellp() > 0) {
|
||||
f_consts_file_ << "-export([" << exports.str() << "]).\n\n"
|
||||
<< functions.str();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates code for an enumerated type. Done using a class to scope
|
||||
* the values.
|
||||
@@ -459,8 +539,11 @@ void t_erl_generator::generate_const(t_const* tconst) {
|
||||
string name = tconst->get_name();
|
||||
t_const_value* value = tconst->get_value();
|
||||
|
||||
f_consts_ << "-define(" << constify(make_safe_for_module_name(program_name_)) << "_"
|
||||
<< constify(name) << ", " << render_const_value(type, value) << ")." << endl << endl;
|
||||
// Save the tconst so that function can be emitted in generate_const_functions().
|
||||
v_consts_.push_back(tconst);
|
||||
|
||||
f_consts_hrl_file_ << "-define(" << constify(make_safe_for_module_name(program_name_)) << "_"
|
||||
<< constify(name) << ", " << render_const_value(type, value) << ")." << endl << endl;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -561,28 +644,32 @@ string t_erl_generator::render_const_value(t_type* type, t_const_value* value) {
|
||||
}
|
||||
out << "])";
|
||||
} else if (type->is_list()) {
|
||||
t_type* etype;
|
||||
etype = ((t_list*)type)->get_elem_type();
|
||||
out << "[";
|
||||
|
||||
bool first = true;
|
||||
const vector<t_const_value*>& val = value->get_list();
|
||||
vector<t_const_value*>::const_iterator v_iter;
|
||||
for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
out << ",";
|
||||
}
|
||||
out << render_const_value(etype, *v_iter);
|
||||
}
|
||||
out << "]";
|
||||
out << "[" << render_const_list_values(type, value) << "]";
|
||||
} else {
|
||||
throw "CANNOT GENERATE CONSTANT FOR TYPE: " + type->get_name();
|
||||
}
|
||||
return out.str();
|
||||
}
|
||||
|
||||
string t_erl_generator::render_const_list_values(t_type* type, t_const_value* value) {
|
||||
std::ostringstream out;
|
||||
t_type* etype = ((t_list*)type)->get_elem_type();
|
||||
|
||||
bool first = true;
|
||||
const vector<t_const_value*>& val = value->get_list();
|
||||
vector<t_const_value*>::const_iterator v_iter;
|
||||
for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
out << ",";
|
||||
}
|
||||
out << render_const_value(etype, *v_iter);
|
||||
}
|
||||
return out.str();
|
||||
}
|
||||
|
||||
|
||||
string t_erl_generator::render_default_value(t_field* field) {
|
||||
t_type* type = field->get_type();
|
||||
if (type->is_struct() || type->is_xception()) {
|
||||
@@ -968,16 +1055,6 @@ void t_erl_generator::export_string(string name, int num) {
|
||||
export_lines_ << name << "/" << num;
|
||||
}
|
||||
|
||||
void t_erl_generator::export_types_function(t_function* tfunction, string prefix) {
|
||||
t_struct::members_type::size_type num = tfunction->get_arglist()->get_members().size();
|
||||
if (num > static_cast<t_struct::members_type::size_type>(std::numeric_limits<int>().max())) {
|
||||
throw "integer overflow in t_erl_generator::export_types_function, name " + tfunction->get_name();
|
||||
}
|
||||
export_types_string(prefix + tfunction->get_name(),
|
||||
1 // This
|
||||
+ static_cast<int>(num));
|
||||
}
|
||||
|
||||
void t_erl_generator::export_types_string(string name, int num) {
|
||||
if (export_types_lines_first_) {
|
||||
export_types_lines_first_ = false;
|
||||
@@ -1019,19 +1096,14 @@ string t_erl_generator::argument_list(t_struct* tstruct) {
|
||||
}
|
||||
|
||||
string t_erl_generator::type_name(t_type* ttype) {
|
||||
string prefix = "";
|
||||
string erl_namespace = ttype->get_program()->get_namespace("erl");
|
||||
|
||||
if (erl_namespace.length() > 0) {
|
||||
prefix = erl_namespace + ".";
|
||||
string prefix = ttype->get_program()->get_namespace("erl");
|
||||
size_t prefix_length = prefix.length();
|
||||
if (prefix_length > 0 && prefix[prefix_length - 1] != '_') {
|
||||
prefix += '.';
|
||||
}
|
||||
|
||||
string name = ttype->get_name();
|
||||
|
||||
if (ttype->is_struct() || ttype->is_xception() || ttype->is_service()) {
|
||||
name = ttype->get_name();
|
||||
}
|
||||
|
||||
return atomify(prefix + name);
|
||||
}
|
||||
|
||||
|
||||
89
vendor/github.com/apache/thrift/compiler/cpp/src/thrift/generate/t_go_generator.cc
generated
vendored
89
vendor/github.com/apache/thrift/compiler/cpp/src/thrift/generate/t_go_generator.cc
generated
vendored
@@ -81,7 +81,7 @@ public:
|
||||
gen_package_prefix_ = "";
|
||||
package_flag = "";
|
||||
read_write_private_ = false;
|
||||
use_context_ = false;
|
||||
legacy_context_ = false;
|
||||
ignore_initialisms_ = false;
|
||||
for( iter = parsed_options.begin(); iter != parsed_options.end(); ++iter) {
|
||||
if( iter->first.compare("package_prefix") == 0) {
|
||||
@@ -92,8 +92,8 @@ public:
|
||||
package_flag = (iter->second);
|
||||
} else if( iter->first.compare("read_write_private") == 0) {
|
||||
read_write_private_ = true;
|
||||
} else if( iter->first.compare("use_context") == 0) {
|
||||
use_context_ = true;
|
||||
} else if( iter->first.compare("legacy_context") == 0) {
|
||||
legacy_context_ = true;
|
||||
} else if( iter->first.compare("ignore_initialisms") == 0) {
|
||||
ignore_initialisms_ = true;
|
||||
} else {
|
||||
@@ -261,8 +261,7 @@ public:
|
||||
std::string function_signature(t_function* tfunction, std::string prefix = "");
|
||||
std::string function_signature_if(t_function* tfunction,
|
||||
std::string prefix = "",
|
||||
bool addError = false,
|
||||
bool enableContext = false);
|
||||
bool addError = false);
|
||||
std::string argument_list(t_struct* tstruct);
|
||||
std::string type_to_enum(t_type* ttype);
|
||||
std::string type_to_go_type(t_type* ttype);
|
||||
@@ -288,7 +287,7 @@ private:
|
||||
std::string gen_package_prefix_;
|
||||
std::string gen_thrift_import_;
|
||||
bool read_write_private_;
|
||||
bool use_context_;
|
||||
bool legacy_context_;
|
||||
bool ignore_initialisms_;
|
||||
|
||||
/**
|
||||
@@ -884,7 +883,10 @@ string t_go_generator::go_imports_begin(bool consts) {
|
||||
"\t\"database/sql/driver\"\n"
|
||||
"\t\"errors\"\n";
|
||||
}
|
||||
if (use_context_) {
|
||||
if (legacy_context_) {
|
||||
extra +=
|
||||
"\t\"golang.org/x/net/context\"\n";
|
||||
} else {
|
||||
extra +=
|
||||
"\t\"context\"\n";
|
||||
}
|
||||
@@ -904,20 +906,13 @@ string t_go_generator::go_imports_begin(bool consts) {
|
||||
* This will have to do in lieu of more intelligent import statement construction
|
||||
*/
|
||||
string t_go_generator::go_imports_end() {
|
||||
string extra;
|
||||
|
||||
if (use_context_) {
|
||||
extra +=
|
||||
"var _ = context.Background\n";
|
||||
}
|
||||
|
||||
return string(
|
||||
")\n\n"
|
||||
"// (needed to ensure safety because of naive import list construction.)\n"
|
||||
"var _ = thrift.ZERO\n"
|
||||
"var _ = fmt.Printf\n"
|
||||
"var _ = context.Background\n"
|
||||
"var _ = reflect.DeepEqual\n"
|
||||
+ extra +
|
||||
"var _ = bytes.Equal\n\n");
|
||||
}
|
||||
|
||||
@@ -1842,7 +1837,7 @@ void t_go_generator::generate_service_interface(t_service* tservice) {
|
||||
|
||||
for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
|
||||
generate_go_docstring(f_types_, (*f_iter));
|
||||
f_types_ << indent() << function_signature_if(*f_iter, "", true, use_context_) << endl;
|
||||
f_types_ << indent() << function_signature_if(*f_iter, "", true) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1956,7 +1951,7 @@ void t_go_generator::generate_service_client(t_service* tservice) {
|
||||
// Open function
|
||||
generate_go_docstring(f_types_, (*f_iter));
|
||||
f_types_ << indent() << "func (p *" << serviceName << "Client) "
|
||||
<< function_signature_if(*f_iter, "", true, false) << " {" << endl;
|
||||
<< function_signature_if(*f_iter, "", true) << " {" << endl;
|
||||
indent_up();
|
||||
/*
|
||||
f_types_ <<
|
||||
@@ -2164,9 +2159,15 @@ void t_go_generator::generate_service_remote(t_service* tservice) {
|
||||
|
||||
string unused_protection;
|
||||
|
||||
string ctxPackage = "context";
|
||||
if (legacy_context_) {
|
||||
ctxPackage = "golang.org/x/net/context";
|
||||
}
|
||||
|
||||
f_remote << go_autogen_comment();
|
||||
f_remote << indent() << "package main" << endl << endl;
|
||||
f_remote << indent() << "import (" << endl;
|
||||
f_remote << indent() << " \"" << ctxPackage << "\"" << endl;
|
||||
f_remote << indent() << " \"flag\"" << endl;
|
||||
f_remote << indent() << " \"fmt\"" << endl;
|
||||
f_remote << indent() << " \"math\"" << endl;
|
||||
@@ -2506,9 +2507,11 @@ void t_go_generator::generate_service_remote(t_service* tservice) {
|
||||
f_remote << indent() << "fmt.Print(client." << pubName << "(";
|
||||
bool argFirst = true;
|
||||
|
||||
f_remote << "context.Background()";
|
||||
for (std::vector<t_field*>::size_type i = 0; i < num_args; ++i) {
|
||||
if (argFirst) {
|
||||
argFirst = false;
|
||||
f_remote << ", ";
|
||||
} else {
|
||||
f_remote << ", ";
|
||||
}
|
||||
@@ -2604,36 +2607,31 @@ void t_go_generator::generate_service_server(t_service* tservice) {
|
||||
// Generate the header portion
|
||||
string self(tmp("self"));
|
||||
|
||||
string processorFunction("thrift.TProcessorFunction");
|
||||
if (use_context_) {
|
||||
processorFunction = "thrift.TProcessorFunction2";
|
||||
}
|
||||
|
||||
if (extends_processor.empty()) {
|
||||
f_types_ << indent() << "type " << serviceName << "Processor struct {" << endl;
|
||||
f_types_ << indent() << " processorMap map[string]" << processorFunction << endl;
|
||||
f_types_ << indent() << " processorMap map[string]thrift.TProcessorFunction" << endl;
|
||||
f_types_ << indent() << " handler " << serviceName << endl;
|
||||
f_types_ << indent() << "}" << endl << endl;
|
||||
f_types_ << indent() << "func (p *" << serviceName
|
||||
<< "Processor) AddToProcessorMap(key string, processor " << processorFunction << ") {"
|
||||
<< "Processor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {"
|
||||
<< endl;
|
||||
f_types_ << indent() << " p.processorMap[key] = processor" << endl;
|
||||
f_types_ << indent() << "}" << endl << endl;
|
||||
f_types_ << indent() << "func (p *" << serviceName
|
||||
<< "Processor) GetProcessorFunction(key string) "
|
||||
"(processor "<< processorFunction << ", ok bool) {" << endl;
|
||||
"(processor thrift.TProcessorFunction, ok bool) {" << endl;
|
||||
f_types_ << indent() << " processor, ok = p.processorMap[key]" << endl;
|
||||
f_types_ << indent() << " return processor, ok" << endl;
|
||||
f_types_ << indent() << "}" << endl << endl;
|
||||
f_types_ << indent() << "func (p *" << serviceName
|
||||
<< "Processor) ProcessorMap() map[string]" << processorFunction << "{" << endl;
|
||||
<< "Processor) ProcessorMap() map[string]thrift.TProcessorFunction {" << endl;
|
||||
f_types_ << indent() << " return p.processorMap" << endl;
|
||||
f_types_ << indent() << "}" << endl << endl;
|
||||
f_types_ << indent() << "func New" << serviceName << "Processor(handler " << serviceName
|
||||
<< ") *" << serviceName << "Processor {" << endl << endl;
|
||||
f_types_
|
||||
<< indent() << " " << self << " := &" << serviceName
|
||||
<< "Processor{handler:handler, processorMap:make(map[string]" << processorFunction << ")}"
|
||||
<< "Processor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)}"
|
||||
<< endl;
|
||||
|
||||
for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
|
||||
@@ -2643,24 +2641,16 @@ void t_go_generator::generate_service_server(t_service* tservice) {
|
||||
<< "{handler:handler}" << endl;
|
||||
}
|
||||
|
||||
string ctxParam("");
|
||||
string ctxVar("");
|
||||
if (use_context_) {
|
||||
ctxParam = "ctx context.Context, ";
|
||||
ctxVar = "ctx, ";
|
||||
}
|
||||
|
||||
string x(tmp("x"));
|
||||
f_types_ << indent() << "return " << self << endl;
|
||||
f_types_ << indent() << "}" << endl << endl;
|
||||
f_types_ << indent() << "func (p *" << serviceName
|
||||
<< "Processor) Process(" << ctxParam
|
||||
<< "iprot, oprot thrift.TProtocol) (success bool, err "
|
||||
<< "Processor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err "
|
||||
"thrift.TException) {" << endl;
|
||||
f_types_ << indent() << " name, _, seqId, err := iprot.ReadMessageBegin()" << endl;
|
||||
f_types_ << indent() << " if err != nil { return false, err }" << endl;
|
||||
f_types_ << indent() << " if processor, ok := p.GetProcessorFunction(name); ok {" << endl;
|
||||
f_types_ << indent() << " return processor.Process(" << ctxVar << "seqId, iprot, oprot)" << endl;
|
||||
f_types_ << indent() << " return processor.Process(ctx, seqId, iprot, oprot)" << endl;
|
||||
f_types_ << indent() << " }" << endl;
|
||||
f_types_ << indent() << " iprot.Skip(thrift.STRUCT)" << endl;
|
||||
f_types_ << indent() << " iprot.ReadMessageEnd()" << endl;
|
||||
@@ -2714,12 +2704,6 @@ void t_go_generator::generate_process_function(t_service* tservice, t_function*
|
||||
string argsname = publicize(tfunction->get_name() + "_args", true);
|
||||
string resultname = publicize(tfunction->get_name() + "_result", true);
|
||||
|
||||
string ctxParam("");
|
||||
string ctxVar("");
|
||||
if (use_context_) {
|
||||
ctxParam = "ctx context.Context, ";
|
||||
ctxVar = "ctx";
|
||||
}
|
||||
// t_struct* xs = tfunction->get_xceptions();
|
||||
// const std::vector<t_field*>& xceptions = xs->get_members();
|
||||
vector<t_field*>::const_iterator x_iter;
|
||||
@@ -2727,7 +2711,7 @@ void t_go_generator::generate_process_function(t_service* tservice, t_function*
|
||||
f_types_ << indent() << " handler " << publicize(tservice->get_name()) << endl;
|
||||
f_types_ << indent() << "}" << endl << endl;
|
||||
f_types_ << indent() << "func (p *" << processorName
|
||||
<< ") Process(" << ctxParam << "seqId int32, iprot, oprot thrift.TProtocol) (success bool, err "
|
||||
<< ") Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err "
|
||||
"thrift.TException) {" << endl;
|
||||
indent_up();
|
||||
f_types_ << indent() << "args := " << argsname << "{}" << endl;
|
||||
@@ -2771,13 +2755,11 @@ void t_go_generator::generate_process_function(t_service* tservice, t_function*
|
||||
f_types_ << "err2 = p.handler." << publicize(tfunction->get_name()) << "(";
|
||||
bool first = true;
|
||||
|
||||
f_types_ << ctxVar;
|
||||
f_types_ << "ctx";
|
||||
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
|
||||
if (first) {
|
||||
first = false;
|
||||
if (use_context_) {
|
||||
f_types_ << ", ";
|
||||
}
|
||||
f_types_ << ", ";
|
||||
} else {
|
||||
f_types_ << ", ";
|
||||
}
|
||||
@@ -3459,15 +3441,12 @@ string t_go_generator::function_signature(t_function* tfunction, string prefix)
|
||||
* Renders an interface function signature of the form 'type name(args)'
|
||||
*
|
||||
* @param tfunction Function definition
|
||||
* @param disableContext Client doesn't suppport context for now.
|
||||
* @return String of rendered function definition
|
||||
*/
|
||||
string t_go_generator::function_signature_if(t_function* tfunction, string prefix, bool addError, bool enableContext) {
|
||||
string t_go_generator::function_signature_if(t_function* tfunction, string prefix, bool addError) {
|
||||
// TODO(mcslee): Nitpicky, no ',' if argument_list is empty
|
||||
string signature = publicize(prefix + tfunction->get_name()) + "(";
|
||||
if (enableContext) {
|
||||
signature += "ctx context.Context, ";
|
||||
}
|
||||
signature += "ctx context.Context, ";
|
||||
signature += argument_list(tfunction->get_arglist()) + ") (";
|
||||
t_type* ret = tfunction->get_returntype();
|
||||
t_struct* exceptions = tfunction->get_xceptions();
|
||||
@@ -3745,5 +3724,5 @@ THRIFT_REGISTER_GENERATOR(go, "Go",
|
||||
" Disable automatic spelling correction of initialisms (e.g. \"URL\")\n" \
|
||||
" read_write_private\n"
|
||||
" Make read/write methods private, default is public Read/Write\n" \
|
||||
" use_context\n"
|
||||
" Make service method receive a context as first argument.\n")
|
||||
" legacy_context\n"
|
||||
" Use legacy x/net/context instead of context in go<1.7.\n")
|
||||
|
||||
4
vendor/github.com/apache/thrift/compiler/cpp/src/thrift/generate/t_js_generator.cc
generated
vendored
4
vendor/github.com/apache/thrift/compiler/cpp/src/thrift/generate/t_js_generator.cc
generated
vendored
@@ -2218,10 +2218,10 @@ std::string t_js_generator::ts_function_signature(t_function* tfunction, bool in
|
||||
}
|
||||
|
||||
if (include_callback) {
|
||||
str += "callback: Function): ";
|
||||
str += "callback: (data: " + ts_get_type(tfunction->get_returntype()) + ")=>void): ";
|
||||
|
||||
if (gen_jquery_) {
|
||||
str += "JQueryXHR;";
|
||||
str += "JQueryPromise<" + ts_get_type(tfunction->get_returntype()) +">;";
|
||||
} else {
|
||||
str += "void;";
|
||||
}
|
||||
|
||||
11
vendor/github.com/apache/thrift/configure.ac
generated
vendored
11
vendor/github.com/apache/thrift/configure.ac
generated
vendored
@@ -397,7 +397,8 @@ if test "$with_go" = "yes"; then
|
||||
AC_PATH_PROG([GO], [go])
|
||||
if [[ -x "$GO" ]] ; then
|
||||
AS_IF([test -n "$GO"],[
|
||||
ax_go_version="1.7"
|
||||
ax_go_version="1.4"
|
||||
ax_go17_version="1.7"
|
||||
|
||||
AC_MSG_CHECKING([for Go version])
|
||||
golang_version=`$GO version 2>&1 | $SED -e 's/\(go \)\(version \)\(go\)\(@<:@0-9@:>@.@<:@0-9@:>@.@<:@0-9@:>@\)\(@<:@\*@:>@*\).*/\4/'`
|
||||
@@ -410,6 +411,13 @@ if test "$with_go" = "yes"; then
|
||||
:
|
||||
have_go="no"
|
||||
])
|
||||
AX_COMPARE_VERSION([$golang_version],[lt],[$ax_go17_version],[
|
||||
:
|
||||
go_version_lt_17="yes"
|
||||
],[
|
||||
:
|
||||
go_version_lt_17="no"
|
||||
])
|
||||
],[
|
||||
AC_MSG_WARN([could not find Go ])
|
||||
have_go="no"
|
||||
@@ -417,6 +425,7 @@ if test "$with_go" = "yes"; then
|
||||
fi
|
||||
fi
|
||||
AM_CONDITIONAL(WITH_GO, [test "$have_go" = "yes"])
|
||||
AM_CONDITIONAL([GOVERSION_LT_17], [test "$go_version_lt_17" = "yes"])
|
||||
|
||||
AX_THRIFT_LIB(rs, [Rust], yes)
|
||||
have_rs="no"
|
||||
|
||||
2
vendor/github.com/apache/thrift/doc/install/README.md
generated
vendored
2
vendor/github.com/apache/thrift/doc/install/README.md
generated
vendored
@@ -39,5 +39,5 @@ These are only required if you choose to build the libraries for the given langu
|
||||
* Bit::Vector
|
||||
* Class::Accessor
|
||||
* Haxe 3.1.3
|
||||
* Go 1.7
|
||||
* Go 1.4
|
||||
* Delphi 2010
|
||||
|
||||
23
vendor/github.com/apache/thrift/lib/delphi/src/Thrift.Utils.pas
generated
vendored
23
vendor/github.com/apache/thrift/lib/delphi/src/Thrift.Utils.pas
generated
vendored
@@ -69,8 +69,9 @@ type
|
||||
end;
|
||||
|
||||
|
||||
function InterlockedCompareExchange64( var Target : Int64; Exchange, Comparand : Int64) : Int64; stdcall;
|
||||
function InterlockedExchangeAdd64( var Addend : Int64; Value : Int64) : Int64; stdcall;
|
||||
{$IFDEF Win64}
|
||||
function InterlockedExchangeAdd64( var Addend : Int64; Value : Int64) : Int64;
|
||||
{$ENDIF}
|
||||
|
||||
|
||||
implementation
|
||||
@@ -223,14 +224,19 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
// natively available since stone age
|
||||
function InterlockedCompareExchange64;
|
||||
external KERNEL32 name 'InterlockedCompareExchange64';
|
||||
{$IFDEF Win64}
|
||||
|
||||
function InterlockedCompareExchange64( var Target : Int64; Exchange, Comparand : Int64) : Int64; inline;
|
||||
begin
|
||||
{$IFDEF OLD_UNIT_NAMES}
|
||||
result := Windows.InterlockedCompareExchange64( Target, Exchange, Comparand);
|
||||
{$ELSE}
|
||||
result := WinApi.Windows.InterlockedCompareExchange64( Target, Exchange, Comparand);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
|
||||
// natively available >= Vista
|
||||
// implemented this way since there are still some people running Windows XP :-(
|
||||
function InterlockedExchangeAdd64( var Addend : Int64; Value : Int64) : Int64; stdcall;
|
||||
function InterlockedExchangeAdd64( var Addend : Int64; Value : Int64) : Int64;
|
||||
var old : Int64;
|
||||
begin
|
||||
repeat
|
||||
@@ -239,6 +245,7 @@ begin
|
||||
result := Old;
|
||||
end;
|
||||
|
||||
{$ENDIF}
|
||||
|
||||
|
||||
end.
|
||||
|
||||
20
vendor/github.com/apache/thrift/lib/delphi/test/TestClient.pas
generated
vendored
20
vendor/github.com/apache/thrift/lib/delphi/test/TestClient.pas
generated
vendored
@@ -39,6 +39,7 @@ uses
|
||||
Thrift.Transport,
|
||||
Thrift.Stream,
|
||||
Thrift.Test,
|
||||
Thrift.Utils,
|
||||
Thrift.Collections,
|
||||
Thrift.Console;
|
||||
|
||||
@@ -88,6 +89,9 @@ type
|
||||
{$IFDEF StressTest}
|
||||
procedure StressTest(const client : TThriftTest.Iface);
|
||||
{$ENDIF}
|
||||
{$IFDEF Win64}
|
||||
procedure UseInterlockedExchangeAdd64;
|
||||
{$ENDIF}
|
||||
protected
|
||||
procedure Execute; override;
|
||||
public
|
||||
@@ -1014,6 +1018,18 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
{$IFDEF Win64}
|
||||
procedure TClientThread.UseInterlockedExchangeAdd64;
|
||||
var a,b : Int64;
|
||||
begin
|
||||
a := 1;
|
||||
b := 2;
|
||||
Thrift.Utils.InterlockedExchangeAdd64( a,b);
|
||||
Expect( a = 3, 'InterlockedExchangeAdd64');
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
|
||||
procedure TClientThread.JSONProtocolReadWriteTest;
|
||||
// Tests only then read/write procedures of the JSON protocol
|
||||
// All tests succeed, if we can read what we wrote before
|
||||
@@ -1249,7 +1265,11 @@ var
|
||||
begin
|
||||
// perform all tests
|
||||
try
|
||||
{$IFDEF Win64}
|
||||
UseInterlockedExchangeAdd64;
|
||||
{$ENDIF}
|
||||
JSONProtocolReadWriteTest;
|
||||
|
||||
for i := 0 to FNumIteration - 1 do
|
||||
begin
|
||||
ClientTest;
|
||||
|
||||
1
vendor/github.com/apache/thrift/lib/erl/Makefile.am
generated
vendored
1
vendor/github.com/apache/thrift/lib/erl/Makefile.am
generated
vendored
@@ -19,6 +19,7 @@
|
||||
|
||||
THRIFT = ../../compiler/cpp/thrift
|
||||
THRIFT_FILES = $(wildcard test/*.thrift) \
|
||||
../../test/ConstantsDemo.thrift \
|
||||
../../test/NameConflictTest.thrift \
|
||||
../../test/ThriftTest.thrift
|
||||
|
||||
|
||||
2
vendor/github.com/apache/thrift/lib/erl/src/thrift_transport.erl
generated
vendored
2
vendor/github.com/apache/thrift/lib/erl/src/thrift_transport.erl
generated
vendored
@@ -103,11 +103,9 @@ read_exact(Transport = #t_transport{module = Module}, Len)
|
||||
when is_integer(Len), Len >= 0 ->
|
||||
case lists:keyfind(read_exact, 1, Module:module_info(exports)) of
|
||||
{read_exact, 2} ->
|
||||
io:fwrite("HAS EXACT"),
|
||||
{NewState, Result} = Module:read_exact(Transport#t_transport.state, Len),
|
||||
{Transport#t_transport{state = NewState}, Result};
|
||||
_ ->
|
||||
io:fwrite("~p NO EXACT", [Module]),
|
||||
read(Transport, Len)
|
||||
end.
|
||||
|
||||
|
||||
54
vendor/github.com/apache/thrift/lib/erl/test/test_const.erl
generated
vendored
Normal file
54
vendor/github.com/apache/thrift/lib/erl/test/test_const.erl
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
%%
|
||||
%% Licensed to the Apache Software Foundation (ASF) under one
|
||||
%% or more contributor license agreements. See the NOTICE file
|
||||
%% distributed with this work for additional information
|
||||
%% regarding copyright ownership. The ASF licenses this file
|
||||
%% to you under the Apache License, Version 2.0 (the
|
||||
%% "License"); you may not use this file except in compliance
|
||||
%% with the License. You may obtain a copy of the License at
|
||||
%%
|
||||
%% http://www.apache.org/licenses/LICENSE-2.0
|
||||
%%
|
||||
%% Unless required by applicable law or agreed to in writing,
|
||||
%% software distributed under the License is distributed on an
|
||||
%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
%% KIND, either express or implied. See the License for the
|
||||
%% specific language governing permissions and limitations
|
||||
%% under the License.
|
||||
%%
|
||||
|
||||
-module(test_const).
|
||||
|
||||
-ifdef(TEST).
|
||||
-include_lib("eunit/include/eunit.hrl").
|
||||
|
||||
-include("gen-erl/constants_demo_types.hrl").
|
||||
|
||||
namespace_test() ->
|
||||
%% Verify that records produced by ConstantsDemo.thrift have the right namespace.
|
||||
io:format(user, "in namespace_test()\n", []),
|
||||
{struct, _} = constants_demo_types:struct_info('consts_thing'),
|
||||
{struct, _} = constants_demo_types:struct_info('consts_Blah'),
|
||||
ok.
|
||||
|
||||
const_map_test() ->
|
||||
?assertEqual(233, constants_demo_constants:gen_map(35532)),
|
||||
?assertError(function_clause, constants_demo_constants:gen_map(0)),
|
||||
|
||||
?assertEqual(853, constants_demo_constants:gen_map(43523, default)),
|
||||
?assertEqual(default, constants_demo_constants:gen_map(10110, default)),
|
||||
|
||||
?assertEqual(98325, constants_demo_constants:gen_map2("lkjsdf")),
|
||||
?assertError(function_clause, constants_demo_constants:gen_map2("nonexist")),
|
||||
|
||||
?assertEqual(233, constants_demo_constants:gen_map2("hello", 321)),
|
||||
?assertEqual(321, constants_demo_constants:gen_map2("goodbye", 321)).
|
||||
|
||||
const_list_test() ->
|
||||
?assertEqual(23598352, constants_demo_constants:gen_list(2)),
|
||||
?assertError(function_clause, constants_demo_constants:gen_list(0)),
|
||||
|
||||
?assertEqual(3253523, constants_demo_constants:gen_list(3, default)),
|
||||
?assertEqual(default, constants_demo_constants:gen_list(10, default)).
|
||||
|
||||
-endif. %% TEST
|
||||
6
vendor/github.com/apache/thrift/lib/go/Makefile.am
generated
vendored
6
vendor/github.com/apache/thrift/lib/go/Makefile.am
generated
vendored
@@ -31,10 +31,12 @@ install:
|
||||
@echo '##############################################################'
|
||||
|
||||
check-local:
|
||||
$(GO) test -race ./thrift
|
||||
GOPATH=`pwd` $(GO) get golang.org/x/net/context
|
||||
GOPATH=`pwd` $(GO) test -race ./thrift
|
||||
|
||||
all-local:
|
||||
$(GO) build ./thrift
|
||||
GOPATH=`pwd` $(GO) get golang.org/x/net/context
|
||||
GOPATH=`pwd` $(GO) build ./thrift
|
||||
|
||||
EXTRA_DIST = \
|
||||
thrift \
|
||||
|
||||
7
vendor/github.com/apache/thrift/lib/go/test/Makefile.am
generated
vendored
7
vendor/github.com/apache/thrift/lib/go/test/Makefile.am
generated
vendored
@@ -17,8 +17,12 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
if GOVERSION_LT_17
|
||||
COMPILER_EXTRAFLAG=",legacy_context"
|
||||
endif
|
||||
|
||||
THRIFT = $(top_builddir)/compiler/cpp/thrift
|
||||
THRIFTARGS = -out gopath/src/ --gen go:thrift_import=thrift
|
||||
THRIFTARGS = -out gopath/src/ --gen go:thrift_import=thrift$(COMPILER_EXTRAFLAG)
|
||||
THRIFTTEST = $(top_srcdir)/test/ThriftTest.thrift
|
||||
|
||||
# Thrift for GO has problems with complex map keys: THRIFT-2063
|
||||
@@ -57,6 +61,7 @@ gopath: $(THRIFT) $(THRIFTTEST) \
|
||||
$(THRIFT) $(THRIFTARGS),read_write_private DontExportRWTest.thrift
|
||||
$(THRIFT) $(THRIFTARGS),ignore_initialisms IgnoreInitialismsTest.thrift
|
||||
GOPATH=`pwd`/gopath $(GO) get github.com/golang/mock/gomock
|
||||
GOPATH=`pwd`/gopath $(GO) get golang.org/x/net/context
|
||||
ln -nfs ../../../thrift gopath/src/thrift
|
||||
ln -nfs ../../tests gopath/src/tests
|
||||
cp -r ./dontexportrwtest gopath/src
|
||||
|
||||
12
vendor/github.com/apache/thrift/lib/go/test/tests/client_error_test.go
generated
vendored
12
vendor/github.com/apache/thrift/lib/go/test/tests/client_error_test.go
generated
vendored
@@ -412,7 +412,7 @@ func TestClientReportTTransportErrors(t *testing.T) {
|
||||
return
|
||||
}
|
||||
client := errortest.NewErrorTestClientProtocol(transport, protocol, protocol)
|
||||
_, retErr := client.TestStruct(thing)
|
||||
_, retErr := client.TestStruct(defaultCtx, thing)
|
||||
mockCtrl.Finish()
|
||||
err2, ok := retErr.(thrift.TTransportException)
|
||||
if !ok {
|
||||
@@ -444,7 +444,7 @@ func TestClientReportTProtocolErrors(t *testing.T) {
|
||||
return
|
||||
}
|
||||
client := errortest.NewErrorTestClientProtocol(transport, protocol, protocol)
|
||||
_, retErr := client.TestStruct(thing)
|
||||
_, retErr := client.TestStruct(defaultCtx, thing)
|
||||
mockCtrl.Finish()
|
||||
err2, ok := retErr.(thrift.TProtocolException)
|
||||
if !ok {
|
||||
@@ -565,7 +565,7 @@ func TestClientCallException(t *testing.T) {
|
||||
willComplete := !prepareClientCallException(protocol, i, err)
|
||||
|
||||
client := errortest.NewErrorTestClientProtocol(transport, protocol, protocol)
|
||||
_, retErr := client.TestString("test")
|
||||
_, retErr := client.TestString(defaultCtx, "test")
|
||||
mockCtrl.Finish()
|
||||
|
||||
if !willComplete {
|
||||
@@ -608,7 +608,7 @@ func TestClientSeqIdMismatch(t *testing.T) {
|
||||
)
|
||||
|
||||
client := errortest.NewErrorTestClientProtocol(transport, protocol, protocol)
|
||||
_, err := client.TestString("test")
|
||||
_, err := client.TestString(defaultCtx, "test")
|
||||
mockCtrl.Finish()
|
||||
appErr, ok := err.(thrift.TApplicationException)
|
||||
if !ok {
|
||||
@@ -638,7 +638,7 @@ func TestClientWrongMethodName(t *testing.T) {
|
||||
)
|
||||
|
||||
client := errortest.NewErrorTestClientProtocol(transport, protocol, protocol)
|
||||
_, err := client.TestString("test")
|
||||
_, err := client.TestString(defaultCtx, "test")
|
||||
mockCtrl.Finish()
|
||||
appErr, ok := err.(thrift.TApplicationException)
|
||||
if !ok {
|
||||
@@ -668,7 +668,7 @@ func TestClientWrongMessageType(t *testing.T) {
|
||||
)
|
||||
|
||||
client := errortest.NewErrorTestClientProtocol(transport, protocol, protocol)
|
||||
_, err := client.TestString("test")
|
||||
_, err := client.TestString(defaultCtx, "test")
|
||||
mockCtrl.Finish()
|
||||
appErr, ok := err.(thrift.TApplicationException)
|
||||
if !ok {
|
||||
|
||||
47
vendor/github.com/apache/thrift/lib/go/test/tests/go17.go
generated
vendored
Normal file
47
vendor/github.com/apache/thrift/lib/go/test/tests/go17.go
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
// +build go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package tests
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
var defaultCtx = context.Background()
|
||||
|
||||
type FirstImpl struct{}
|
||||
|
||||
func (f *FirstImpl) ReturnOne(ctx context.Context) (r int64, err error) {
|
||||
return 1, nil
|
||||
}
|
||||
|
||||
type SecondImpl struct{}
|
||||
|
||||
func (s *SecondImpl) ReturnTwo(ctx context.Context) (r int64, err error) {
|
||||
return 2, nil
|
||||
}
|
||||
|
||||
type impl struct{}
|
||||
|
||||
func (i *impl) Hi(ctx context.Context, in int64, s string) (err error) { fmt.Println("Hi!"); return }
|
||||
func (i *impl) Emptyfunc(ctx context.Context) (err error) { return }
|
||||
func (i *impl) EchoInt(ctx context.Context, param int64) (r int64, err error) { return param, nil }
|
||||
19
vendor/github.com/apache/thrift/lib/go/test/tests/multiplexed_protocol_test.go
generated
vendored
19
vendor/github.com/apache/thrift/lib/go/test/tests/multiplexed_protocol_test.go
generated
vendored
@@ -36,17 +36,6 @@ func FindAvailableTCPServerPort() net.Addr {
|
||||
}
|
||||
}
|
||||
|
||||
type FirstImpl struct{}
|
||||
|
||||
func (f *FirstImpl) ReturnOne() (r int64, err error) {
|
||||
return 1, nil
|
||||
}
|
||||
|
||||
type SecondImpl struct{}
|
||||
|
||||
func (s *SecondImpl) ReturnTwo() (r int64, err error) {
|
||||
return 2, nil
|
||||
}
|
||||
|
||||
var processor = thrift.NewTMultiplexedProcessor()
|
||||
|
||||
@@ -114,7 +103,7 @@ func createLegacyClient(t *testing.T) *multiplexedprotocoltest.SecondClient {
|
||||
}
|
||||
|
||||
func TestCallFirst(t *testing.T) {
|
||||
ret, err := firstClient.ReturnOne()
|
||||
ret, err := firstClient.ReturnOne(defaultCtx)
|
||||
if err != nil {
|
||||
t.Fatal("Unable to call first server:", err)
|
||||
}
|
||||
@@ -124,7 +113,7 @@ func TestCallFirst(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCallSecond(t *testing.T) {
|
||||
ret, err := secondClient.ReturnTwo()
|
||||
ret, err := secondClient.ReturnTwo(defaultCtx)
|
||||
if err != nil {
|
||||
t.Fatal("Unable to call second server:", err)
|
||||
}
|
||||
@@ -135,7 +124,7 @@ func TestCallSecond(t *testing.T) {
|
||||
|
||||
func TestCallLegacy(t *testing.T) {
|
||||
legacyClient := createLegacyClient(t)
|
||||
ret, err := legacyClient.ReturnTwo()
|
||||
ret, err := legacyClient.ReturnTwo(defaultCtx)
|
||||
//expect error since default processor is not registered
|
||||
if err == nil {
|
||||
t.Fatal("Expecting error")
|
||||
@@ -143,7 +132,7 @@ func TestCallLegacy(t *testing.T) {
|
||||
//register default processor and call again
|
||||
processor.RegisterDefault(multiplexedprotocoltest.NewSecondProcessor(&SecondImpl{}))
|
||||
legacyClient = createLegacyClient(t)
|
||||
ret, err = legacyClient.ReturnTwo()
|
||||
ret, err = legacyClient.ReturnTwo(defaultCtx)
|
||||
if err != nil {
|
||||
t.Fatal("Unable to call legacy server:", err)
|
||||
}
|
||||
|
||||
11
vendor/github.com/apache/thrift/lib/go/test/tests/one_way_test.go
generated
vendored
11
vendor/github.com/apache/thrift/lib/go/test/tests/one_way_test.go
generated
vendored
@@ -20,7 +20,6 @@
|
||||
package tests
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"onewaytest"
|
||||
"testing"
|
||||
@@ -37,12 +36,6 @@ func findPort() net.Addr {
|
||||
}
|
||||
}
|
||||
|
||||
type impl struct{}
|
||||
|
||||
func (i *impl) Hi(in int64, s string) (err error) { fmt.Println("Hi!"); return }
|
||||
func (i *impl) Emptyfunc() (err error) { return }
|
||||
func (i *impl) EchoInt(param int64) (r int64, err error) { return param, nil }
|
||||
|
||||
const TIMEOUT = time.Second
|
||||
|
||||
var addr net.Addr
|
||||
@@ -75,12 +68,12 @@ func TestInitOnewayClient(t *testing.T) {
|
||||
|
||||
func TestCallOnewayServer(t *testing.T) {
|
||||
//call oneway function
|
||||
err := client.Hi(1, "")
|
||||
err := client.Hi(defaultCtx, 1, "")
|
||||
if err != nil {
|
||||
t.Fatal("Unexpected error: ", err)
|
||||
}
|
||||
//There is no way to detect protocol problems with single oneway call so we call it second time
|
||||
i, err := client.EchoInt(42)
|
||||
i, err := client.EchoInt(defaultCtx, 42)
|
||||
if err != nil {
|
||||
t.Fatal("Unexpected error: ", err)
|
||||
}
|
||||
|
||||
48
vendor/github.com/apache/thrift/lib/go/test/tests/pre_go17.go
generated
vendored
Normal file
48
vendor/github.com/apache/thrift/lib/go/test/tests/pre_go17.go
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
// +build !go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package tests
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
var defaultCtx = context.Background()
|
||||
|
||||
type FirstImpl struct{}
|
||||
|
||||
func (f *FirstImpl) ReturnOne(ctx context.Context) (r int64, err error) {
|
||||
return 1, nil
|
||||
}
|
||||
|
||||
type SecondImpl struct{}
|
||||
|
||||
func (s *SecondImpl) ReturnTwo(ctx context.Context) (r int64, err error) {
|
||||
return 2, nil
|
||||
}
|
||||
|
||||
type impl struct{}
|
||||
|
||||
func (i *impl) Hi(ctx context.Context, in int64, s string) (err error) { fmt.Println("Hi!"); return }
|
||||
func (i *impl) Emptyfunc(ctx context.Context) (err error) { return }
|
||||
func (i *impl) EchoInt(ctx context.Context, param int64) (r int64, err error) { return param, nil }
|
||||
2
vendor/github.com/apache/thrift/lib/go/test/tests/struct_args_rets_test.go
generated
vendored
2
vendor/github.com/apache/thrift/lib/go/test/tests/struct_args_rets_test.go
generated
vendored
@@ -30,7 +30,7 @@ func staticCheckStructArgsResults() {
|
||||
var iface st.AServ
|
||||
var err error
|
||||
|
||||
sa, err = iface.StructAFunc_1structA(sa)
|
||||
sa, err = iface.StructAFunc_1structA(defaultCtx, sa)
|
||||
_ = err
|
||||
_ = sa
|
||||
}
|
||||
|
||||
60
vendor/github.com/apache/thrift/lib/go/test/tests/thrifttest_driver.go
generated
vendored
60
vendor/github.com/apache/thrift/lib/go/test/tests/thrifttest_driver.go
generated
vendored
@@ -38,15 +38,15 @@ func (p *ThriftTestDriver) Start() {
|
||||
client := p.client
|
||||
t := p.t
|
||||
|
||||
if client.TestVoid() != nil {
|
||||
if client.TestVoid(defaultCtx) != nil {
|
||||
t.Fatal("TestVoid failed")
|
||||
}
|
||||
|
||||
if r, err := client.TestString("Test"); r != "Test" || err != nil {
|
||||
if r, err := client.TestString(defaultCtx, "Test"); r != "Test" || err != nil {
|
||||
t.Fatal("TestString with simple text failed")
|
||||
}
|
||||
|
||||
if r, err := client.TestString(""); r != "" || err != nil {
|
||||
if r, err := client.TestString(defaultCtx, ""); r != "" || err != nil {
|
||||
t.Fatal("TestString with empty text failed")
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ func (p *ThriftTestDriver) Start() {
|
||||
"Walon, Winaray, 吴语, isiXhosa, ייִדיש, Yorùbá, Zeêuws, 中文, " +
|
||||
"Bân-lâm-gú, 粵語"
|
||||
|
||||
if r, err := client.TestString(stringTest); r != stringTest || err != nil {
|
||||
if r, err := client.TestString(defaultCtx, stringTest); r != stringTest || err != nil {
|
||||
t.Fatal("TestString with all languages failed")
|
||||
}
|
||||
|
||||
@@ -86,44 +86,44 @@ func (p *ThriftTestDriver) Start() {
|
||||
" now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><" +
|
||||
" char-to-test-json-parsing: ]] \"]] \\\" }}}{ [[[ "
|
||||
|
||||
if r, err := client.TestString(specialCharacters); r != specialCharacters || err != nil {
|
||||
if r, err := client.TestString(defaultCtx, specialCharacters); r != specialCharacters || err != nil {
|
||||
t.Fatal("TestString with specialCharacters failed")
|
||||
}
|
||||
|
||||
if r, err := client.TestByte(1); r != 1 || err != nil {
|
||||
if r, err := client.TestByte(defaultCtx, 1); r != 1 || err != nil {
|
||||
t.Fatal("TestByte(1) failed")
|
||||
}
|
||||
if r, err := client.TestByte(0); r != 0 || err != nil {
|
||||
if r, err := client.TestByte(defaultCtx, 0); r != 0 || err != nil {
|
||||
t.Fatal("TestByte(0) failed")
|
||||
}
|
||||
if r, err := client.TestByte(-1); r != -1 || err != nil {
|
||||
if r, err := client.TestByte(defaultCtx, -1); r != -1 || err != nil {
|
||||
t.Fatal("TestByte(-1) failed")
|
||||
}
|
||||
if r, err := client.TestByte(-127); r != -127 || err != nil {
|
||||
if r, err := client.TestByte(defaultCtx, -127); r != -127 || err != nil {
|
||||
t.Fatal("TestByte(-127) failed")
|
||||
}
|
||||
|
||||
if r, err := client.TestI32(-1); r != -1 || err != nil {
|
||||
if r, err := client.TestI32(defaultCtx, -1); r != -1 || err != nil {
|
||||
t.Fatal("TestI32(-1) failed")
|
||||
}
|
||||
if r, err := client.TestI32(1); r != 1 || err != nil {
|
||||
if r, err := client.TestI32(defaultCtx, 1); r != 1 || err != nil {
|
||||
t.Fatal("TestI32(1) failed")
|
||||
}
|
||||
|
||||
if r, err := client.TestI64(-5); r != -5 || err != nil {
|
||||
if r, err := client.TestI64(defaultCtx, -5); r != -5 || err != nil {
|
||||
t.Fatal("TestI64(-5) failed")
|
||||
}
|
||||
if r, err := client.TestI64(5); r != 5 || err != nil {
|
||||
if r, err := client.TestI64(defaultCtx, 5); r != 5 || err != nil {
|
||||
t.Fatal("TestI64(5) failed")
|
||||
}
|
||||
if r, err := client.TestI64(-34359738368); r != -34359738368 || err != nil {
|
||||
if r, err := client.TestI64(defaultCtx, -34359738368); r != -34359738368 || err != nil {
|
||||
t.Fatal("TestI64(-34359738368) failed")
|
||||
}
|
||||
|
||||
if r, err := client.TestDouble(-5.2098523); r != -5.2098523 || err != nil {
|
||||
if r, err := client.TestDouble(defaultCtx, -5.2098523); r != -5.2098523 || err != nil {
|
||||
t.Fatal("TestDouble(-5.2098523) failed")
|
||||
}
|
||||
if r, err := client.TestDouble(-7.012052175215044); r != -7.012052175215044 || err != nil {
|
||||
if r, err := client.TestDouble(defaultCtx, -7.012052175215044); r != -7.012052175215044 || err != nil {
|
||||
t.Fatal("TestDouble(-7.012052175215044) failed")
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ func (p *ThriftTestDriver) Start() {
|
||||
out.ByteThing = 1
|
||||
out.I32Thing = -3
|
||||
out.I64Thing = 1000000
|
||||
if r, err := client.TestStruct(out); !reflect.DeepEqual(r, out) || err != nil {
|
||||
if r, err := client.TestStruct(defaultCtx, out); !reflect.DeepEqual(r, out) || err != nil {
|
||||
t.Fatal("TestStruct failed")
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ func (p *ThriftTestDriver) Start() {
|
||||
out2.ByteThing = 1
|
||||
out2.StructThing = out
|
||||
out2.I32Thing = 5
|
||||
if r, err := client.TestNest(out2); !reflect.DeepEqual(r, out2) || err != nil {
|
||||
if r, err := client.TestNest(defaultCtx, out2); !reflect.DeepEqual(r, out2) || err != nil {
|
||||
t.Fatal("TestNest failed")
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ func (p *ThriftTestDriver) Start() {
|
||||
for i := int32(0); i < 5; i++ {
|
||||
mapout[i] = i - 10
|
||||
}
|
||||
if r, err := client.TestMap(mapout); !reflect.DeepEqual(r, mapout) || err != nil {
|
||||
if r, err := client.TestMap(defaultCtx, mapout); !reflect.DeepEqual(r, mapout) || err != nil {
|
||||
t.Fatal("TestMap failed")
|
||||
}
|
||||
|
||||
@@ -158,25 +158,25 @@ func (p *ThriftTestDriver) Start() {
|
||||
"a": "123", "a b": "with spaces ", "same": "same", "0": "numeric key",
|
||||
"longValue": stringTest, stringTest: "long key",
|
||||
}
|
||||
if r, err := client.TestStringMap(mapTestInput); !reflect.DeepEqual(r, mapTestInput) || err != nil {
|
||||
if r, err := client.TestStringMap(defaultCtx, mapTestInput); !reflect.DeepEqual(r, mapTestInput) || err != nil {
|
||||
t.Fatal("TestStringMap failed")
|
||||
}
|
||||
|
||||
setTestInput := []int32{1, 2, 3}
|
||||
if r, err := client.TestSet(setTestInput); !reflect.DeepEqual(r, setTestInput) || err != nil {
|
||||
if r, err := client.TestSet(defaultCtx, setTestInput); !reflect.DeepEqual(r, setTestInput) || err != nil {
|
||||
t.Fatal("TestSet failed")
|
||||
}
|
||||
|
||||
listTest := []int32{1, 2, 3}
|
||||
if r, err := client.TestList(listTest); !reflect.DeepEqual(r, listTest) || err != nil {
|
||||
if r, err := client.TestList(defaultCtx, listTest); !reflect.DeepEqual(r, listTest) || err != nil {
|
||||
t.Fatal("TestList failed")
|
||||
}
|
||||
|
||||
if r, err := client.TestEnum(thrifttest.Numberz_ONE); r != thrifttest.Numberz_ONE || err != nil {
|
||||
if r, err := client.TestEnum(defaultCtx, thrifttest.Numberz_ONE); r != thrifttest.Numberz_ONE || err != nil {
|
||||
t.Fatal("TestEnum failed")
|
||||
}
|
||||
|
||||
if r, err := client.TestTypedef(69); r != 69 || err != nil {
|
||||
if r, err := client.TestTypedef(defaultCtx, 69); r != 69 || err != nil {
|
||||
t.Fatal("TestTypedef failed")
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ func (p *ThriftTestDriver) Start() {
|
||||
4: {1: 1, 2: 2, 3: 3, 4: 4},
|
||||
-4: {-4: -4, -3: -3, -2: -2, -1: -1},
|
||||
}
|
||||
if r, err := client.TestMapMap(1); !reflect.DeepEqual(r, mapMapTest) || err != nil {
|
||||
if r, err := client.TestMapMap(defaultCtx, 1); !reflect.DeepEqual(r, mapMapTest) || err != nil {
|
||||
t.Fatal("TestMapMap failed")
|
||||
}
|
||||
|
||||
@@ -212,25 +212,25 @@ func (p *ThriftTestDriver) Start() {
|
||||
1: {thrifttest.Numberz_TWO: crazy, thrifttest.Numberz_THREE: crazy},
|
||||
2: {thrifttest.Numberz_SIX: crazyEmpty},
|
||||
}
|
||||
if r, err := client.TestInsanity(crazy); !reflect.DeepEqual(r, insanity) || err != nil {
|
||||
if r, err := client.TestInsanity(defaultCtx, crazy); !reflect.DeepEqual(r, insanity) || err != nil {
|
||||
t.Fatal("TestInsanity failed")
|
||||
}
|
||||
|
||||
if err := client.TestException("TException"); err == nil {
|
||||
if err := client.TestException(defaultCtx, "TException"); err == nil {
|
||||
t.Fatal("TestException TException failed")
|
||||
}
|
||||
|
||||
if err, ok := client.TestException("Xception").(*thrifttest.Xception); ok == false || err == nil {
|
||||
if err, ok := client.TestException(defaultCtx, "Xception").(*thrifttest.Xception); ok == false || err == nil {
|
||||
t.Fatal("TestException Xception failed")
|
||||
} else if err.ErrorCode != 1001 || err.Message != "Xception" {
|
||||
t.Fatal("TestException Xception failed")
|
||||
}
|
||||
|
||||
if err := client.TestException("no Exception"); err != nil {
|
||||
if err := client.TestException(defaultCtx, "no Exception"); err != nil {
|
||||
t.Fatal("TestException no Exception failed")
|
||||
}
|
||||
|
||||
if err := client.TestOneway(0); err != nil {
|
||||
if err := client.TestOneway(defaultCtx, 0); err != nil {
|
||||
t.Fatal("TestOneway failed")
|
||||
}
|
||||
}
|
||||
|
||||
52
vendor/github.com/apache/thrift/lib/go/test/tests/thrifttest_handler.go
generated
vendored
52
vendor/github.com/apache/thrift/lib/go/test/tests/thrifttest_handler.go
generated
vendored
@@ -1,3 +1,5 @@
|
||||
// +build !go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
@@ -24,6 +26,8 @@ import (
|
||||
"thrift"
|
||||
"thrifttest"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
type SecondServiceHandler struct {
|
||||
@@ -33,11 +37,11 @@ func NewSecondServiceHandler() *SecondServiceHandler {
|
||||
return &SecondServiceHandler{}
|
||||
}
|
||||
|
||||
func (p *SecondServiceHandler) BlahBlah() (err error) {
|
||||
func (p *SecondServiceHandler) BlahBlah(ctx context.Context) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *SecondServiceHandler) SecondtestString(thing string) (r string, err error) {
|
||||
func (p *SecondServiceHandler) SecondtestString(ctx context.Context, thing string) (r string, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
@@ -48,71 +52,71 @@ func NewThriftTestHandler() *ThriftTestHandler {
|
||||
return &ThriftTestHandler{}
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestVoid() (err error) {
|
||||
func (p *ThriftTestHandler) TestVoid(ctx context.Context) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestString(thing string) (r string, err error) {
|
||||
func (p *ThriftTestHandler) TestString(ctx context.Context, thing string) (r string, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestBool(thing bool) (r bool, err error) {
|
||||
func (p *ThriftTestHandler) TestBool(ctx context.Context, thing bool) (r bool, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestByte(thing int8) (r int8, err error) {
|
||||
func (p *ThriftTestHandler) TestByte(ctx context.Context, thing int8) (r int8, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestI32(thing int32) (r int32, err error) {
|
||||
func (p *ThriftTestHandler) TestI32(ctx context.Context, thing int32) (r int32, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestI64(thing int64) (r int64, err error) {
|
||||
func (p *ThriftTestHandler) TestI64(ctx context.Context, thing int64) (r int64, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestDouble(thing float64) (r float64, err error) {
|
||||
func (p *ThriftTestHandler) TestDouble(ctx context.Context, thing float64) (r float64, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestBinary(thing []byte) (r []byte, err error) {
|
||||
func (p *ThriftTestHandler) TestBinary(ctx context.Context, thing []byte) (r []byte, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestStruct(thing *thrifttest.Xtruct) (r *thrifttest.Xtruct, err error) {
|
||||
func (p *ThriftTestHandler) TestStruct(ctx context.Context, thing *thrifttest.Xtruct) (r *thrifttest.Xtruct, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestNest(thing *thrifttest.Xtruct2) (r *thrifttest.Xtruct2, err error) {
|
||||
func (p *ThriftTestHandler) TestNest(ctx context.Context, thing *thrifttest.Xtruct2) (r *thrifttest.Xtruct2, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestMap(thing map[int32]int32) (r map[int32]int32, err error) {
|
||||
func (p *ThriftTestHandler) TestMap(ctx context.Context, thing map[int32]int32) (r map[int32]int32, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestStringMap(thing map[string]string) (r map[string]string, err error) {
|
||||
func (p *ThriftTestHandler) TestStringMap(ctx context.Context, thing map[string]string) (r map[string]string, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestSet(thing []int32) (r []int32, err error) {
|
||||
func (p *ThriftTestHandler) TestSet(ctx context.Context, thing []int32) (r []int32, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestList(thing []int32) (r []int32, err error) {
|
||||
func (p *ThriftTestHandler) TestList(ctx context.Context, thing []int32) (r []int32, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestEnum(thing thrifttest.Numberz) (r thrifttest.Numberz, err error) {
|
||||
func (p *ThriftTestHandler) TestEnum(ctx context.Context, thing thrifttest.Numberz) (r thrifttest.Numberz, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestTypedef(thing thrifttest.UserId) (r thrifttest.UserId, err error) {
|
||||
func (p *ThriftTestHandler) TestTypedef(ctx context.Context, thing thrifttest.UserId) (r thrifttest.UserId, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestMapMap(hello int32) (r map[int32]map[int32]int32, err error) {
|
||||
func (p *ThriftTestHandler) TestMapMap(ctx context.Context, hello int32) (r map[int32]map[int32]int32, err error) {
|
||||
r = make(map[int32]map[int32]int32)
|
||||
pos := make(map[int32]int32)
|
||||
neg := make(map[int32]int32)
|
||||
@@ -127,7 +131,7 @@ func (p *ThriftTestHandler) TestMapMap(hello int32) (r map[int32]map[int32]int32
|
||||
return r, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestInsanity(argument *thrifttest.Insanity) (r map[thrifttest.UserId]map[thrifttest.Numberz]*thrifttest.Insanity, err error) {
|
||||
func (p *ThriftTestHandler) TestInsanity(ctx context.Context, argument *thrifttest.Insanity) (r map[thrifttest.UserId]map[thrifttest.Numberz]*thrifttest.Insanity, err error) {
|
||||
hello := thrifttest.NewXtruct()
|
||||
hello.StringThing = "Hello2"
|
||||
hello.ByteThing = 2
|
||||
@@ -162,7 +166,7 @@ func (p *ThriftTestHandler) TestInsanity(argument *thrifttest.Insanity) (r map[t
|
||||
return insane, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestMulti(arg0 int8, arg1 int32, arg2 int64, arg3 map[int16]string, arg4 thrifttest.Numberz, arg5 thrifttest.UserId) (r *thrifttest.Xtruct, err error) {
|
||||
func (p *ThriftTestHandler) TestMulti(ctx context.Context, arg0 int8, arg1 int32, arg2 int64, arg3 map[int16]string, arg4 thrifttest.Numberz, arg5 thrifttest.UserId) (r *thrifttest.Xtruct, err error) {
|
||||
r = thrifttest.NewXtruct()
|
||||
r.StringThing = "Hello2"
|
||||
r.ByteThing = arg0
|
||||
@@ -171,7 +175,7 @@ func (p *ThriftTestHandler) TestMulti(arg0 int8, arg1 int32, arg2 int64, arg3 ma
|
||||
return r, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestException(arg string) (err error) {
|
||||
func (p *ThriftTestHandler) TestException(ctx context.Context, arg string) (err error) {
|
||||
if arg == "Xception" {
|
||||
x := thrifttest.NewXception()
|
||||
x.ErrorCode = 1001
|
||||
@@ -184,7 +188,7 @@ func (p *ThriftTestHandler) TestException(arg string) (err error) {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestMultiException(arg0 string, arg1 string) (r *thrifttest.Xtruct, err error) {
|
||||
func (p *ThriftTestHandler) TestMultiException(ctx context.Context, arg0 string, arg1 string) (r *thrifttest.Xtruct, err error) {
|
||||
if arg0 == "Xception" {
|
||||
x := thrifttest.NewXception()
|
||||
x.ErrorCode = 1001
|
||||
@@ -203,7 +207,7 @@ func (p *ThriftTestHandler) TestMultiException(arg0 string, arg1 string) (r *thr
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestOneway(secondsToSleep int32) (err error) {
|
||||
func (p *ThriftTestHandler) TestOneway(ctx context.Context, secondsToSleep int32) (err error) {
|
||||
time.Sleep(time.Second * time.Duration(secondsToSleep))
|
||||
return nil
|
||||
}
|
||||
|
||||
212
vendor/github.com/apache/thrift/lib/go/test/tests/thrifttest_handler_go17.go
generated
vendored
Normal file
212
vendor/github.com/apache/thrift/lib/go/test/tests/thrifttest_handler_go17.go
generated
vendored
Normal file
@@ -0,0 +1,212 @@
|
||||
// +build go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* 'License'); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package tests
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"thrift"
|
||||
"thrifttest"
|
||||
"time"
|
||||
)
|
||||
|
||||
type SecondServiceHandler struct {
|
||||
}
|
||||
|
||||
func NewSecondServiceHandler() *SecondServiceHandler {
|
||||
return &SecondServiceHandler{}
|
||||
}
|
||||
|
||||
func (p *SecondServiceHandler) BlahBlah(ctx context.Context) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *SecondServiceHandler) SecondtestString(ctx context.Context, thing string) (r string, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
type ThriftTestHandler struct {
|
||||
}
|
||||
|
||||
func NewThriftTestHandler() *ThriftTestHandler {
|
||||
return &ThriftTestHandler{}
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestVoid(ctx context.Context) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestString(ctx context.Context, thing string) (r string, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestBool(ctx context.Context, thing bool) (r bool, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestByte(ctx context.Context, thing int8) (r int8, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestI32(ctx context.Context, thing int32) (r int32, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestI64(ctx context.Context, thing int64) (r int64, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestDouble(ctx context.Context, thing float64) (r float64, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestBinary(ctx context.Context, thing []byte) (r []byte, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestStruct(ctx context.Context, thing *thrifttest.Xtruct) (r *thrifttest.Xtruct, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestNest(ctx context.Context, thing *thrifttest.Xtruct2) (r *thrifttest.Xtruct2, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestMap(ctx context.Context, thing map[int32]int32) (r map[int32]int32, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestStringMap(ctx context.Context, thing map[string]string) (r map[string]string, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestSet(ctx context.Context, thing []int32) (r []int32, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestList(ctx context.Context, thing []int32) (r []int32, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestEnum(ctx context.Context, thing thrifttest.Numberz) (r thrifttest.Numberz, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestTypedef(ctx context.Context, thing thrifttest.UserId) (r thrifttest.UserId, err error) {
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestMapMap(ctx context.Context, hello int32) (r map[int32]map[int32]int32, err error) {
|
||||
r = make(map[int32]map[int32]int32)
|
||||
pos := make(map[int32]int32)
|
||||
neg := make(map[int32]int32)
|
||||
|
||||
for i := int32(1); i < 5; i++ {
|
||||
pos[i] = i
|
||||
neg[-i] = -i
|
||||
}
|
||||
r[4] = pos
|
||||
r[-4] = neg
|
||||
|
||||
return r, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestInsanity(ctx context.Context, argument *thrifttest.Insanity) (r map[thrifttest.UserId]map[thrifttest.Numberz]*thrifttest.Insanity, err error) {
|
||||
hello := thrifttest.NewXtruct()
|
||||
hello.StringThing = "Hello2"
|
||||
hello.ByteThing = 2
|
||||
hello.I32Thing = 2
|
||||
hello.I64Thing = 2
|
||||
|
||||
goodbye := thrifttest.NewXtruct()
|
||||
goodbye.StringThing = "Goodbye4"
|
||||
goodbye.ByteThing = 4
|
||||
goodbye.I32Thing = 4
|
||||
goodbye.I64Thing = 4
|
||||
|
||||
crazy := thrifttest.NewInsanity()
|
||||
crazy.UserMap = make(map[thrifttest.Numberz]thrifttest.UserId)
|
||||
crazy.UserMap[thrifttest.Numberz_EIGHT] = 8
|
||||
crazy.UserMap[thrifttest.Numberz_FIVE] = 5
|
||||
crazy.Xtructs = []*thrifttest.Xtruct{goodbye, hello}
|
||||
|
||||
first_map := make(map[thrifttest.Numberz]*thrifttest.Insanity)
|
||||
second_map := make(map[thrifttest.Numberz]*thrifttest.Insanity)
|
||||
|
||||
first_map[thrifttest.Numberz_TWO] = crazy
|
||||
first_map[thrifttest.Numberz_THREE] = crazy
|
||||
|
||||
looney := thrifttest.NewInsanity()
|
||||
second_map[thrifttest.Numberz_SIX] = looney
|
||||
|
||||
var insane = make(map[thrifttest.UserId]map[thrifttest.Numberz]*thrifttest.Insanity)
|
||||
insane[1] = first_map
|
||||
insane[2] = second_map
|
||||
|
||||
return insane, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestMulti(ctx context.Context, arg0 int8, arg1 int32, arg2 int64, arg3 map[int16]string, arg4 thrifttest.Numberz, arg5 thrifttest.UserId) (r *thrifttest.Xtruct, err error) {
|
||||
r = thrifttest.NewXtruct()
|
||||
r.StringThing = "Hello2"
|
||||
r.ByteThing = arg0
|
||||
r.I32Thing = arg1
|
||||
r.I64Thing = arg2
|
||||
return r, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestException(ctx context.Context, arg string) (err error) {
|
||||
if arg == "Xception" {
|
||||
x := thrifttest.NewXception()
|
||||
x.ErrorCode = 1001
|
||||
x.Message = arg
|
||||
return x
|
||||
} else if arg == "TException" {
|
||||
return thrift.TException(errors.New(arg))
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestMultiException(ctx context.Context, arg0 string, arg1 string) (r *thrifttest.Xtruct, err error) {
|
||||
if arg0 == "Xception" {
|
||||
x := thrifttest.NewXception()
|
||||
x.ErrorCode = 1001
|
||||
x.Message = "This is an Xception"
|
||||
return nil, x
|
||||
} else if arg0 == "Xception2" {
|
||||
x2 := thrifttest.NewXception2()
|
||||
x2.ErrorCode = 2002
|
||||
x2.StructThing = thrifttest.NewXtruct()
|
||||
x2.StructThing.StringThing = "This is an Xception2"
|
||||
return nil, x2
|
||||
}
|
||||
|
||||
res := thrifttest.NewXtruct()
|
||||
res.StringThing = arg1
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (p *ThriftTestHandler) TestOneway(ctx context.Context, secondsToSleep int32) (err error) {
|
||||
time.Sleep(time.Second * time.Duration(secondsToSleep))
|
||||
return nil
|
||||
}
|
||||
32
vendor/github.com/apache/thrift/lib/go/thrift/common_test_go17.go
generated
vendored
Normal file
32
vendor/github.com/apache/thrift/lib/go/thrift/common_test_go17.go
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
// +build go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package thrift
|
||||
|
||||
import "context"
|
||||
|
||||
type mockProcessor struct {
|
||||
ProcessFunc func(in, out TProtocol) (bool, TException)
|
||||
}
|
||||
|
||||
func (m *mockProcessor) Process(ctx context.Context, in, out TProtocol) (bool, TException) {
|
||||
return m.ProcessFunc(in, out)
|
||||
}
|
||||
32
vendor/github.com/apache/thrift/lib/go/thrift/common_test_pre_go17.go
generated
vendored
Normal file
32
vendor/github.com/apache/thrift/lib/go/thrift/common_test_pre_go17.go
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
// +build !go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package thrift
|
||||
|
||||
import "golang.org/x/net/context"
|
||||
|
||||
type mockProcessor struct {
|
||||
ProcessFunc func(in, out TProtocol) (bool, TException)
|
||||
}
|
||||
|
||||
func (m *mockProcessor) Process(ctx context.Context, in, out TProtocol) (bool, TException) {
|
||||
return m.ProcessFunc(in, out)
|
||||
}
|
||||
26
vendor/github.com/apache/thrift/lib/go/thrift/go17.go
generated
vendored
Normal file
26
vendor/github.com/apache/thrift/lib/go/thrift/go17.go
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
// +build go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package thrift
|
||||
|
||||
import "context"
|
||||
|
||||
var defaultCtx = context.Background()
|
||||
25
vendor/github.com/apache/thrift/lib/go/thrift/http_transport.go
generated
vendored
25
vendor/github.com/apache/thrift/lib/go/thrift/http_transport.go
generated
vendored
@@ -21,36 +21,11 @@ package thrift
|
||||
|
||||
import (
|
||||
"compress/gzip"
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// NewThriftHandlerFunc is a function that create a ready to use Apache Thrift Handler function
|
||||
func NewThriftHandlerFunc(processor TProcessor,
|
||||
inPfactory, outPfactory TProtocolFactory) func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
return gz(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Add("Content-Type", "application/x-thrift")
|
||||
|
||||
transport := NewStreamTransport(r.Body, w)
|
||||
processor.Process(inPfactory.GetProtocol(transport), outPfactory.GetProtocol(transport))
|
||||
})
|
||||
}
|
||||
|
||||
// NewThriftHandlerFunc2 is same as NewThriftHandlerFunc but requires a Context as its first param.
|
||||
func NewThriftHandlerFunc2(ctx context.Context, processor TProcessor2,
|
||||
inPfactory, outPfactory TProtocolFactory) func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
return gz(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Add("Content-Type", "application/x-thrift")
|
||||
|
||||
transport := NewStreamTransport(r.Body, w)
|
||||
processor.Process(ctx, inPfactory.GetProtocol(transport), outPfactory.GetProtocol(transport))
|
||||
})
|
||||
}
|
||||
|
||||
// gz transparently compresses the HTTP response if the client supports it.
|
||||
func gz(handler http.HandlerFunc) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
38
vendor/github.com/apache/thrift/lib/go/thrift/http_transport_go17.go
generated
vendored
Normal file
38
vendor/github.com/apache/thrift/lib/go/thrift/http_transport_go17.go
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
// +build go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package thrift
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// NewThriftHandlerFunc is a function that create a ready to use Apache Thrift Handler function
|
||||
func NewThriftHandlerFunc(processor TProcessor,
|
||||
inPfactory, outPfactory TProtocolFactory) func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
return gz(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Add("Content-Type", "application/x-thrift")
|
||||
|
||||
transport := NewStreamTransport(r.Body, w)
|
||||
processor.Process(r.Context(), inPfactory.GetProtocol(transport), outPfactory.GetProtocol(transport))
|
||||
})
|
||||
}
|
||||
40
vendor/github.com/apache/thrift/lib/go/thrift/http_transport_pre_go17.go
generated
vendored
Normal file
40
vendor/github.com/apache/thrift/lib/go/thrift/http_transport_pre_go17.go
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
// +build !go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package thrift
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// NewThriftHandlerFunc is a function that create a ready to use Apache Thrift Handler function
|
||||
func NewThriftHandlerFunc(processor TProcessor,
|
||||
inPfactory, outPfactory TProtocolFactory) func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
return gz(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Add("Content-Type", "application/x-thrift")
|
||||
|
||||
transport := NewStreamTransport(r.Body, w)
|
||||
processor.Process(context.Background(), inPfactory.GetProtocol(transport), outPfactory.GetProtocol(transport))
|
||||
})
|
||||
}
|
||||
58
vendor/github.com/apache/thrift/lib/go/thrift/multiplexed_protocol.go
generated
vendored
58
vendor/github.com/apache/thrift/lib/go/thrift/multiplexed_protocol.go
generated
vendored
@@ -19,11 +19,6 @@
|
||||
|
||||
package thrift
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
/*
|
||||
TMultiplexedProtocol is a protocol-independent concrete decorator
|
||||
that allows a Thrift client to communicate with a multiplexing Thrift server,
|
||||
@@ -76,11 +71,33 @@ func (t *TMultiplexedProtocol) WriteMessageBegin(name string, typeId TMessageTyp
|
||||
}
|
||||
|
||||
/*
|
||||
This is the non-context version for TProcessor.
|
||||
TMultiplexedProcessor is a TProcessor allowing
|
||||
a single TServer to provide multiple services.
|
||||
|
||||
See description at file: multiplexed_processor.go
|
||||
To do so, you instantiate the processor and then register additional
|
||||
processors with it, as shown in the following example:
|
||||
|
||||
Deprecated: use TMultiplexedProcessor2 for strong server programming.
|
||||
var processor = thrift.NewTMultiplexedProcessor()
|
||||
|
||||
firstProcessor :=
|
||||
processor.RegisterProcessor("FirstService", firstProcessor)
|
||||
|
||||
processor.registerProcessor(
|
||||
"Calculator",
|
||||
Calculator.NewCalculatorProcessor(&CalculatorHandler{}),
|
||||
)
|
||||
|
||||
processor.registerProcessor(
|
||||
"WeatherReport",
|
||||
WeatherReport.NewWeatherReportProcessor(&WeatherReportHandler{}),
|
||||
)
|
||||
|
||||
serverTransport, err := thrift.NewTServerSocketTimeout(addr, TIMEOUT)
|
||||
if err != nil {
|
||||
t.Fatal("Unable to create server socket", err)
|
||||
}
|
||||
server := thrift.NewTSimpleServer2(processor, serverTransport)
|
||||
server.Serve();
|
||||
*/
|
||||
|
||||
type TMultiplexedProcessor struct {
|
||||
@@ -105,31 +122,6 @@ func (t *TMultiplexedProcessor) RegisterProcessor(name string, processor TProces
|
||||
t.serviceProcessorMap[name] = processor
|
||||
}
|
||||
|
||||
func (t *TMultiplexedProcessor) Process(in, out TProtocol) (bool, TException) {
|
||||
name, typeId, seqid, err := in.ReadMessageBegin()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if typeId != CALL && typeId != ONEWAY {
|
||||
return false, fmt.Errorf("Unexpected message type %v", typeId)
|
||||
}
|
||||
//extract the service name
|
||||
v := strings.SplitN(name, MULTIPLEXED_SEPARATOR, 2)
|
||||
if len(v) != 2 {
|
||||
if t.DefaultProcessor != nil {
|
||||
smb := NewStoredMessageProtocol(in, name, typeId, seqid)
|
||||
return t.DefaultProcessor.Process(smb, out)
|
||||
}
|
||||
return false, fmt.Errorf("Service name not found in message name: %s. Did you forget to use a TMultiplexProtocol in your client?", name)
|
||||
}
|
||||
actualProcessor, ok := t.serviceProcessorMap[v[0]]
|
||||
if !ok {
|
||||
return false, fmt.Errorf("Service name not found: %s. Did you forget to call registerProcessor()?", v[0])
|
||||
}
|
||||
smb := NewStoredMessageProtocol(in, v[1], typeId, seqid)
|
||||
return actualProcessor.Process(smb, out)
|
||||
}
|
||||
|
||||
//Protocol that use stored message for ReadMessageBegin
|
||||
type storedMessageProtocol struct {
|
||||
TProtocol
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// +build go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
@@ -25,60 +27,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
/*
|
||||
TMultiplexedProcessor2 is a TProcessor allowing
|
||||
a single TServer to provide multiple services with
|
||||
context support in TProcessor.
|
||||
|
||||
To do so, you instantiate the processor and then register additional
|
||||
processors with it, as shown in the following example:
|
||||
|
||||
var processor = thrift.NewTMultiplexedProcessor2()
|
||||
|
||||
firstProcessor :=
|
||||
processor.RegisterProcessor("FirstService", firstProcessor)
|
||||
|
||||
processor.registerProcessor(
|
||||
"Calculator",
|
||||
Calculator.NewCalculatorProcessor(&CalculatorHandler{}),
|
||||
)
|
||||
|
||||
processor.registerProcessor(
|
||||
"WeatherReport",
|
||||
WeatherReport.NewWeatherReportProcessor(&WeatherReportHandler{}),
|
||||
)
|
||||
|
||||
serverTransport, err := thrift.NewTServerSocketTimeout(addr, TIMEOUT)
|
||||
if err != nil {
|
||||
t.Fatal("Unable to create server socket", err)
|
||||
}
|
||||
server := thrift.NewTSimpleServer2(processor, serverTransport)
|
||||
server.Serve();
|
||||
*/
|
||||
|
||||
type TMultiplexedProcessor2 struct {
|
||||
serviceProcessorMap map[string]TProcessor2
|
||||
DefaultProcessor TProcessor2
|
||||
}
|
||||
|
||||
func NewTMultiplexedProcessor2() *TMultiplexedProcessor2 {
|
||||
return &TMultiplexedProcessor2{
|
||||
serviceProcessorMap: make(map[string]TProcessor2),
|
||||
}
|
||||
}
|
||||
|
||||
func (t *TMultiplexedProcessor2) RegisterDefault(processor TProcessor2) {
|
||||
t.DefaultProcessor = processor
|
||||
}
|
||||
|
||||
func (t *TMultiplexedProcessor2) RegisterProcessor(name string, processor TProcessor2) {
|
||||
if t.serviceProcessorMap == nil {
|
||||
t.serviceProcessorMap = make(map[string]TProcessor2)
|
||||
}
|
||||
t.serviceProcessorMap[name] = processor
|
||||
}
|
||||
|
||||
func (t *TMultiplexedProcessor2) Process(ctx context.Context, in, out TProtocol) (bool, TException) {
|
||||
func (t *TMultiplexedProcessor) Process(ctx context.Context, in, out TProtocol) (bool, TException) {
|
||||
name, typeId, seqid, err := in.ReadMessageBegin()
|
||||
if err != nil {
|
||||
return false, err
|
||||
54
vendor/github.com/apache/thrift/lib/go/thrift/multiplexed_protocol_pre_go17.go
generated
vendored
Normal file
54
vendor/github.com/apache/thrift/lib/go/thrift/multiplexed_protocol_pre_go17.go
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
// +build !go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package thrift
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
func (t *TMultiplexedProcessor) Process(ctx context.Context, in, out TProtocol) (bool, TException) {
|
||||
name, typeId, seqid, err := in.ReadMessageBegin()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if typeId != CALL && typeId != ONEWAY {
|
||||
return false, fmt.Errorf("Unexpected message type %v", typeId)
|
||||
}
|
||||
//extract the service name
|
||||
v := strings.SplitN(name, MULTIPLEXED_SEPARATOR, 2)
|
||||
if len(v) != 2 {
|
||||
if t.DefaultProcessor != nil {
|
||||
smb := NewStoredMessageProtocol(in, name, typeId, seqid)
|
||||
return t.DefaultProcessor.Process(ctx, smb, out)
|
||||
}
|
||||
return false, fmt.Errorf("Service name not found in message name: %s. Did you forget to use a TMultiplexProtocol in your client?", name)
|
||||
}
|
||||
actualProcessor, ok := t.serviceProcessorMap[v[0]]
|
||||
if !ok {
|
||||
return false, fmt.Errorf("Service name not found: %s. Did you forget to call registerProcessor()?", v[0])
|
||||
}
|
||||
smb := NewStoredMessageProtocol(in, v[1], typeId, seqid)
|
||||
return actualProcessor.Process(ctx, smb, out)
|
||||
}
|
||||
26
vendor/github.com/apache/thrift/lib/go/thrift/pre_go17.go
generated
vendored
Normal file
26
vendor/github.com/apache/thrift/lib/go/thrift/pre_go17.go
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
// +build !go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package thrift
|
||||
|
||||
import "golang.org/x/net/context"
|
||||
|
||||
var defaultCtx = context.Background()
|
||||
15
vendor/github.com/apache/thrift/lib/go/thrift/processor.go
generated
vendored
15
vendor/github.com/apache/thrift/lib/go/thrift/processor.go
generated
vendored
@@ -1,3 +1,5 @@
|
||||
// +build !go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
@@ -19,23 +21,14 @@
|
||||
|
||||
package thrift
|
||||
|
||||
import "context"
|
||||
import "golang.org/x/net/context"
|
||||
|
||||
// A processor is a generic object which operates upon an input stream and
|
||||
// writes to some output stream.
|
||||
type TProcessor interface {
|
||||
Process(in, out TProtocol) (bool, TException)
|
||||
}
|
||||
|
||||
type TProcessorFunction interface {
|
||||
Process(seqId int32, in, out TProtocol) (bool, TException)
|
||||
}
|
||||
|
||||
// TProcessor2 is TProcessor with ctx as its first argument.
|
||||
type TProcessor2 interface {
|
||||
Process(ctx context.Context, in, out TProtocol) (bool, TException)
|
||||
}
|
||||
|
||||
type TProcessorFunction2 interface {
|
||||
type TProcessorFunction interface {
|
||||
Process(ctx context.Context, seqId int32, in, out TProtocol) (bool, TException)
|
||||
}
|
||||
|
||||
59
vendor/github.com/apache/thrift/lib/go/thrift/processor_factory2.go
generated
vendored
59
vendor/github.com/apache/thrift/lib/go/thrift/processor_factory2.go
generated
vendored
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package thrift
|
||||
|
||||
// The default processor2 factory just returns a singleton
|
||||
// instance.
|
||||
// The TProcessorFactory2 is a context version of the orignal.
|
||||
type TProcessorFactory2 interface {
|
||||
GetProcessor(trans TTransport) TProcessor2
|
||||
}
|
||||
|
||||
type tProcessorFactory2 struct {
|
||||
processor TProcessor2
|
||||
}
|
||||
|
||||
func NewTProcessorFactory2(p TProcessor2) TProcessorFactory2 {
|
||||
return &tProcessorFactory2{processor: p}
|
||||
}
|
||||
|
||||
func (p *tProcessorFactory2) GetProcessor(trans TTransport) TProcessor2 {
|
||||
return p.processor
|
||||
}
|
||||
|
||||
/**
|
||||
* The default processor factory2 just returns a singleton
|
||||
* instance.
|
||||
*/
|
||||
type TProcessorFunctionFactory2 interface {
|
||||
GetProcessorFunction(trans TTransport) TProcessorFunction2
|
||||
}
|
||||
|
||||
type tProcessorFunctionFactory2 struct {
|
||||
processor TProcessorFunction2
|
||||
}
|
||||
|
||||
func NewTProcessorFunctionFactory2(p TProcessorFunction2) TProcessorFunctionFactory2 {
|
||||
return &tProcessorFunctionFactory2{processor: p}
|
||||
}
|
||||
|
||||
func (p *tProcessorFunctionFactory2) GetProcessorFunction(trans TTransport) TProcessorFunction2 {
|
||||
return p.processor
|
||||
}
|
||||
34
vendor/github.com/apache/thrift/lib/go/thrift/processor_go17.go
generated
vendored
Normal file
34
vendor/github.com/apache/thrift/lib/go/thrift/processor_go17.go
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
// +build go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package thrift
|
||||
|
||||
import "context"
|
||||
|
||||
// A processor is a generic object which operates upon an input stream and
|
||||
// writes to some output stream.
|
||||
type TProcessor interface {
|
||||
Process(ctx context.Context, in, out TProtocol) (bool, TException)
|
||||
}
|
||||
|
||||
type TProcessorFunction interface {
|
||||
Process(ctx context.Context, seqId int32, in, out TProtocol) (bool, TException)
|
||||
}
|
||||
16
vendor/github.com/apache/thrift/lib/go/thrift/server.go
generated
vendored
16
vendor/github.com/apache/thrift/lib/go/thrift/server.go
generated
vendored
@@ -33,19 +33,3 @@ type TServer interface {
|
||||
// all servers are required to be cleanly stoppable.
|
||||
Stop() error
|
||||
}
|
||||
|
||||
// Same as TServer but use TProcessorFactory2 as processor factory.
|
||||
type TServer2 interface {
|
||||
ProcessorFactory() TProcessorFactory2
|
||||
ServerTransport() TServerTransport
|
||||
InputTransportFactory() TTransportFactory
|
||||
OutputTransportFactory() TTransportFactory
|
||||
InputProtocolFactory() TProtocolFactory
|
||||
OutputProtocolFactory() TProtocolFactory
|
||||
|
||||
// Starts the server
|
||||
Serve() error
|
||||
// Stops the server. This is optional on a per-implementation basis. Not
|
||||
// all servers are required to be cleanly stoppable.
|
||||
Stop() error
|
||||
}
|
||||
|
||||
2
vendor/github.com/apache/thrift/lib/go/thrift/simple_server.go
generated
vendored
2
vendor/github.com/apache/thrift/lib/go/thrift/simple_server.go
generated
vendored
@@ -198,7 +198,7 @@ func (p *TSimpleServer) processRequests(client TTransport) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
ok, err := processor.Process(inputProtocol, outputProtocol)
|
||||
ok, err := processor.Process(defaultCtx, inputProtocol, outputProtocol)
|
||||
if err, ok := err.(TTransportException); ok && err.TypeId() == END_OF_FILE {
|
||||
return nil
|
||||
} else if err != nil {
|
||||
|
||||
180
vendor/github.com/apache/thrift/lib/go/thrift/simple_server2.go
generated
vendored
180
vendor/github.com/apache/thrift/lib/go/thrift/simple_server2.go
generated
vendored
@@ -1,180 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package thrift
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"runtime/debug"
|
||||
"sync"
|
||||
)
|
||||
|
||||
/*
|
||||
* This is only a simple sample same as TSimpleServer but add context
|
||||
* usage support.
|
||||
*/
|
||||
type TSimpleServer2 struct {
|
||||
quit chan struct{}
|
||||
|
||||
processorFactory TProcessorFactory2
|
||||
serverTransport TServerTransport
|
||||
inputTransportFactory TTransportFactory
|
||||
outputTransportFactory TTransportFactory
|
||||
inputProtocolFactory TProtocolFactory
|
||||
outputProtocolFactory TProtocolFactory
|
||||
sync.WaitGroup
|
||||
}
|
||||
|
||||
func NewTSimpleServerWithContext(processor TProcessor2, serverTransport TServerTransport) *TSimpleServer2 {
|
||||
return NewTSimpleServerFactoryWithContext(NewTProcessorFactory2(processor), serverTransport)
|
||||
}
|
||||
|
||||
func NewTSimpleServerFactoryWithContext(processorFactory TProcessorFactory2, serverTransport TServerTransport) *TSimpleServer2 {
|
||||
return &TSimpleServer2{
|
||||
quit: make(chan struct{}, 1),
|
||||
processorFactory: processorFactory,
|
||||
serverTransport: serverTransport,
|
||||
inputTransportFactory: NewTTransportFactory(),
|
||||
outputTransportFactory: NewTTransportFactory(),
|
||||
inputProtocolFactory: NewTBinaryProtocolFactoryDefault(),
|
||||
outputProtocolFactory: NewTBinaryProtocolFactoryDefault(),
|
||||
}
|
||||
}
|
||||
|
||||
func (p *TSimpleServer2) ProcessorFactory() TProcessorFactory2 {
|
||||
return p.processorFactory
|
||||
}
|
||||
|
||||
func (p *TSimpleServer2) ServerTransport() TServerTransport {
|
||||
return p.serverTransport
|
||||
}
|
||||
|
||||
func (p *TSimpleServer2) InputTransportFactory() TTransportFactory {
|
||||
return p.inputTransportFactory
|
||||
}
|
||||
|
||||
func (p *TSimpleServer2) OutputTransportFactory() TTransportFactory {
|
||||
return p.outputTransportFactory
|
||||
}
|
||||
|
||||
func (p *TSimpleServer2) InputProtocolFactory() TProtocolFactory {
|
||||
return p.inputProtocolFactory
|
||||
}
|
||||
|
||||
func (p *TSimpleServer2) OutputProtocolFactory() TProtocolFactory {
|
||||
return p.outputProtocolFactory
|
||||
}
|
||||
|
||||
func (p *TSimpleServer2) Listen() error {
|
||||
return p.serverTransport.Listen()
|
||||
}
|
||||
|
||||
func (p *TSimpleServer2) AcceptLoop() error {
|
||||
for {
|
||||
client, err := p.serverTransport.Accept()
|
||||
if err != nil {
|
||||
select {
|
||||
case <-p.quit:
|
||||
return nil
|
||||
default:
|
||||
}
|
||||
return err
|
||||
}
|
||||
if client != nil {
|
||||
p.Add(1)
|
||||
go func() {
|
||||
if err := p.processRequests(client); err != nil {
|
||||
log.Println("error processing request:", err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (p *TSimpleServer2) Serve() error {
|
||||
err := p.Listen()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
p.AcceptLoop()
|
||||
return nil
|
||||
}
|
||||
|
||||
var once2 sync.Once
|
||||
|
||||
func (p *TSimpleServer2) Stop() error {
|
||||
q := func() {
|
||||
close(p.quit)
|
||||
p.serverTransport.Interrupt()
|
||||
p.Wait()
|
||||
}
|
||||
once2.Do(q)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *TSimpleServer2) processRequests(client TTransport) error {
|
||||
defer p.Done()
|
||||
|
||||
processor := p.processorFactory.GetProcessor(client)
|
||||
inputTransport, err := p.inputTransportFactory.GetTransport(client)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
outputTransport, err := p.outputTransportFactory.GetTransport(client)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
inputProtocol := p.inputProtocolFactory.GetProtocol(inputTransport)
|
||||
outputProtocol := p.outputProtocolFactory.GetProtocol(outputTransport)
|
||||
defer func() {
|
||||
if e := recover(); e != nil {
|
||||
log.Printf("panic in processor: %s: %s", e, debug.Stack())
|
||||
}
|
||||
}()
|
||||
|
||||
if inputTransport != nil {
|
||||
defer inputTransport.Close()
|
||||
}
|
||||
if outputTransport != nil {
|
||||
defer outputTransport.Close()
|
||||
}
|
||||
for {
|
||||
select {
|
||||
case <-p.quit:
|
||||
return nil
|
||||
default:
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
ok, err := processor.Process(ctx, inputProtocol, outputProtocol)
|
||||
if err, ok := err.(TTransportException); ok && err.TypeId() == END_OF_FILE {
|
||||
return nil
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
if err, ok := err.(TApplicationException); ok && err.TypeId() == UNKNOWN_METHOD {
|
||||
continue
|
||||
}
|
||||
if !ok {
|
||||
break
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
8
vendor/github.com/apache/thrift/lib/go/thrift/simple_server_test.go
generated
vendored
8
vendor/github.com/apache/thrift/lib/go/thrift/simple_server_test.go
generated
vendored
@@ -24,14 +24,6 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type mockProcessor struct {
|
||||
ProcessFunc func(in, out TProtocol) (bool, TException)
|
||||
}
|
||||
|
||||
func (m *mockProcessor) Process(in, out TProtocol) (bool, TException) {
|
||||
return m.ProcessFunc(in, out)
|
||||
}
|
||||
|
||||
type mockServerTransport struct {
|
||||
ListenFunc func() error
|
||||
AcceptFunc func() (TTransport, error)
|
||||
|
||||
1
vendor/github.com/apache/thrift/test/ConstantsDemo.thrift
generated
vendored
1
vendor/github.com/apache/thrift/test/ConstantsDemo.thrift
generated
vendored
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
namespace cpp yozone
|
||||
namespace erl consts_
|
||||
|
||||
struct thing {
|
||||
1: i32 hello,
|
||||
|
||||
8
vendor/github.com/apache/thrift/test/go/Makefile.am
generated
vendored
8
vendor/github.com/apache/thrift/test/go/Makefile.am
generated
vendored
@@ -18,9 +18,12 @@
|
||||
#
|
||||
|
||||
BUILT_SOURCES = gopath
|
||||
if GOVERSION_LT_17
|
||||
COMPILER_EXTRAFLAG=",legacy_context"
|
||||
endif
|
||||
|
||||
THRIFT = $(top_builddir)/compiler/cpp/thrift
|
||||
THRIFTCMD = $(THRIFT) -out src/gen --gen go:thrift_import=thrift
|
||||
THRIFTCMD = $(THRIFT) -out src/gen --gen go:thrift_import=thrift$(COMPILER_EXTRAFLAG)
|
||||
THRIFTTEST = $(top_srcdir)/test/ThriftTest.thrift
|
||||
|
||||
precross: bin/testclient bin/testserver
|
||||
@@ -35,6 +38,7 @@ gopath: $(THRIFT) ThriftTest.thrift
|
||||
$(THRIFTCMD) ../StressTest.thrift
|
||||
ln -nfs ../../../lib/go/thrift src/thrift
|
||||
GOPATH=`pwd` $(GO) get github.com/golang/mock/gomock
|
||||
GOPATH=`pwd` $(GO) get golang.org/x/net/context
|
||||
touch gopath
|
||||
|
||||
bin/testclient: gopath
|
||||
@@ -51,7 +55,7 @@ clean-local:
|
||||
|
||||
check_PROGRAMS: bin/testclient bin/testserver bin/stress
|
||||
|
||||
check: gopath
|
||||
check: gopath genmock
|
||||
GOPATH=`pwd` $(GO) test -v common/...
|
||||
|
||||
genmock: gopath
|
||||
|
||||
62
vendor/github.com/apache/thrift/test/go/src/bin/stress/go17.go
generated
vendored
Normal file
62
vendor/github.com/apache/thrift/test/go/src/bin/stress/go17.go
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
// +build go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync/atomic"
|
||||
)
|
||||
|
||||
type handler struct{}
|
||||
|
||||
func (h *handler) EchoVoid(ctx context.Context) (err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return nil
|
||||
}
|
||||
func (h *handler) EchoByte(ctx context.Context, arg int8) (r int8, err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return arg, nil
|
||||
}
|
||||
func (h *handler) EchoI32(ctx context.Context, arg int32) (r int32, err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return arg, nil
|
||||
}
|
||||
func (h *handler) EchoI64(ctx context.Context, arg int64) (r int64, err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return arg, nil
|
||||
}
|
||||
func (h *handler) EchoString(ctx context.Context, arg string) (r string, err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return arg, nil
|
||||
}
|
||||
func (h *handler) EchoList(ctx context.Context, arg []int8) (r []int8, err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return arg, nil
|
||||
}
|
||||
func (h *handler) EchoSet(ctx context.Context, arg map[int8]struct{}) (r map[int8]struct{}, err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return arg, nil
|
||||
}
|
||||
func (h *handler) EchoMap(ctx context.Context, arg map[int8]int8) (r map[int8]int8, err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return arg, nil
|
||||
}
|
||||
35
vendor/github.com/apache/thrift/test/go/src/bin/stress/main.go
generated
vendored
35
vendor/github.com/apache/thrift/test/go/src/bin/stress/main.go
generated
vendored
@@ -216,38 +216,3 @@ func client(protocolFactory thrift.TProtocolFactory) {
|
||||
|
||||
done.Done()
|
||||
}
|
||||
|
||||
type handler struct{}
|
||||
|
||||
func (h *handler) EchoVoid() (err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return nil
|
||||
}
|
||||
func (h *handler) EchoByte(arg int8) (r int8, err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return arg, nil
|
||||
}
|
||||
func (h *handler) EchoI32(arg int32) (r int32, err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return arg, nil
|
||||
}
|
||||
func (h *handler) EchoI64(arg int64) (r int64, err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return arg, nil
|
||||
}
|
||||
func (h *handler) EchoString(arg string) (r string, err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return arg, nil
|
||||
}
|
||||
func (h *handler) EchoList(arg []int8) (r []int8, err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return arg, nil
|
||||
}
|
||||
func (h *handler) EchoSet(arg map[int8]struct{}) (r map[int8]struct{}, err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return arg, nil
|
||||
}
|
||||
func (h *handler) EchoMap(arg map[int8]int8) (r map[int8]int8, err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return arg, nil
|
||||
}
|
||||
|
||||
63
vendor/github.com/apache/thrift/test/go/src/bin/stress/pre_go17.go
generated
vendored
Normal file
63
vendor/github.com/apache/thrift/test/go/src/bin/stress/pre_go17.go
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
// +build !go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"sync/atomic"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
type handler struct{}
|
||||
|
||||
func (h *handler) EchoVoid(ctx context.Context) (err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return nil
|
||||
}
|
||||
func (h *handler) EchoByte(ctx context.Context, arg int8) (r int8, err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return arg, nil
|
||||
}
|
||||
func (h *handler) EchoI32(ctx context.Context, arg int32) (r int32, err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return arg, nil
|
||||
}
|
||||
func (h *handler) EchoI64(ctx context.Context, arg int64) (r int64, err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return arg, nil
|
||||
}
|
||||
func (h *handler) EchoString(ctx context.Context, arg string) (r string, err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return arg, nil
|
||||
}
|
||||
func (h *handler) EchoList(ctx context.Context, arg []int8) (r []int8, err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return arg, nil
|
||||
}
|
||||
func (h *handler) EchoSet(ctx context.Context, arg map[int8]struct{}) (r map[int8]struct{}, err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return arg, nil
|
||||
}
|
||||
func (h *handler) EchoMap(ctx context.Context, arg map[int8]int8) (r map[int8]int8, err error) {
|
||||
atomic.AddInt64(&counter, 1)
|
||||
return arg, nil
|
||||
}
|
||||
26
vendor/github.com/apache/thrift/test/go/src/bin/testclient/go17.go
generated
vendored
Normal file
26
vendor/github.com/apache/thrift/test/go/src/bin/testclient/go17.go
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
// +build go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import "context"
|
||||
|
||||
var defaultCtx = context.Background()
|
||||
54
vendor/github.com/apache/thrift/test/go/src/bin/testclient/main.go
generated
vendored
54
vendor/github.com/apache/thrift/test/go/src/bin/testclient/main.go
generated
vendored
@@ -63,11 +63,11 @@ var xcept = &thrifttest.Xception{ErrorCode: 1001, Message: "Xception"}
|
||||
|
||||
func callEverything(client *thrifttest.ThriftTestClient) {
|
||||
var err error
|
||||
if err = client.TestVoid(); err != nil {
|
||||
if err = client.TestVoid(defaultCtx); err != nil {
|
||||
t.Fatalf("Unexpected error in TestVoid() call: ", err)
|
||||
}
|
||||
|
||||
thing, err := client.TestString("thing")
|
||||
thing, err := client.TestString(defaultCtx, "thing")
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error in TestString() call: ", err)
|
||||
}
|
||||
@@ -75,14 +75,14 @@ func callEverything(client *thrifttest.ThriftTestClient) {
|
||||
t.Fatalf("Unexpected TestString() result, expected 'thing' got '%s' ", thing)
|
||||
}
|
||||
|
||||
bl, err := client.TestBool(true)
|
||||
bl, err := client.TestBool(defaultCtx, true)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error in TestBool() call: ", err)
|
||||
}
|
||||
if !bl {
|
||||
t.Fatalf("Unexpected TestBool() result expected true, got %f ", bl)
|
||||
}
|
||||
bl, err = client.TestBool(false)
|
||||
bl, err = client.TestBool(defaultCtx, false)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error in TestBool() call: ", err)
|
||||
}
|
||||
@@ -90,7 +90,7 @@ func callEverything(client *thrifttest.ThriftTestClient) {
|
||||
t.Fatalf("Unexpected TestBool() result expected false, got %f ", bl)
|
||||
}
|
||||
|
||||
b, err := client.TestByte(42)
|
||||
b, err := client.TestByte(defaultCtx, 42)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error in TestByte() call: ", err)
|
||||
}
|
||||
@@ -98,7 +98,7 @@ func callEverything(client *thrifttest.ThriftTestClient) {
|
||||
t.Fatalf("Unexpected TestByte() result expected 42, got %d ", b)
|
||||
}
|
||||
|
||||
i32, err := client.TestI32(4242)
|
||||
i32, err := client.TestI32(defaultCtx, 4242)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error in TestI32() call: ", err)
|
||||
}
|
||||
@@ -106,7 +106,7 @@ func callEverything(client *thrifttest.ThriftTestClient) {
|
||||
t.Fatalf("Unexpected TestI32() result expected 4242, got %d ", i32)
|
||||
}
|
||||
|
||||
i64, err := client.TestI64(424242)
|
||||
i64, err := client.TestI64(defaultCtx, 424242)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error in TestI64() call: ", err)
|
||||
}
|
||||
@@ -114,7 +114,7 @@ func callEverything(client *thrifttest.ThriftTestClient) {
|
||||
t.Fatalf("Unexpected TestI64() result expected 424242, got %d ", i64)
|
||||
}
|
||||
|
||||
d, err := client.TestDouble(42.42)
|
||||
d, err := client.TestDouble(defaultCtx, 42.42)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error in TestDouble() call: ", err)
|
||||
}
|
||||
@@ -126,19 +126,19 @@ func callEverything(client *thrifttest.ThriftTestClient) {
|
||||
for i := 0; i < 256; i++ {
|
||||
binout[i] = byte(i)
|
||||
}
|
||||
bin, err := client.TestBinary(binout)
|
||||
bin, err := client.TestBinary(defaultCtx, binout)
|
||||
for i := 0; i < 256; i++ {
|
||||
if (binout[i] != bin[i]) {
|
||||
t.Fatalf("Unexpected TestBinary() result expected %d, got %d ", binout[i], bin[i])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
xs := thrifttest.NewXtruct()
|
||||
xs.StringThing = "thing"
|
||||
xs.ByteThing = 42
|
||||
xs.I32Thing = 4242
|
||||
xs.I64Thing = 424242
|
||||
xsret, err := client.TestStruct(xs)
|
||||
xsret, err := client.TestStruct(defaultCtx, xs)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error in TestStruct() call: ", err)
|
||||
}
|
||||
@@ -148,7 +148,7 @@ func callEverything(client *thrifttest.ThriftTestClient) {
|
||||
|
||||
x2 := thrifttest.NewXtruct2()
|
||||
x2.StructThing = xs
|
||||
x2ret, err := client.TestNest(x2)
|
||||
x2ret, err := client.TestNest(defaultCtx, x2)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error in TestNest() call: ", err)
|
||||
}
|
||||
@@ -157,7 +157,7 @@ func callEverything(client *thrifttest.ThriftTestClient) {
|
||||
}
|
||||
|
||||
m := map[int32]int32{1: 2, 3: 4, 5: 42}
|
||||
mret, err := client.TestMap(m)
|
||||
mret, err := client.TestMap(defaultCtx, m)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error in TestMap() call: ", err)
|
||||
}
|
||||
@@ -166,7 +166,7 @@ func callEverything(client *thrifttest.ThriftTestClient) {
|
||||
}
|
||||
|
||||
sm := map[string]string{"a": "2", "b": "blah", "some": "thing"}
|
||||
smret, err := client.TestStringMap(sm)
|
||||
smret, err := client.TestStringMap(defaultCtx, sm)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error in TestStringMap() call: ", err)
|
||||
}
|
||||
@@ -175,7 +175,7 @@ func callEverything(client *thrifttest.ThriftTestClient) {
|
||||
}
|
||||
|
||||
s := []int32{1, 2, 42}
|
||||
sret, err := client.TestSet(s)
|
||||
sret, err := client.TestSet(defaultCtx, s)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error in TestSet() call: ", err)
|
||||
}
|
||||
@@ -191,7 +191,7 @@ func callEverything(client *thrifttest.ThriftTestClient) {
|
||||
}
|
||||
|
||||
l := []int32{1, 2, 42}
|
||||
lret, err := client.TestList(l)
|
||||
lret, err := client.TestList(defaultCtx, l)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error in TestList() call: ", err)
|
||||
}
|
||||
@@ -199,7 +199,7 @@ func callEverything(client *thrifttest.ThriftTestClient) {
|
||||
t.Fatalf("Unexpected TestList() result expected %#v, got %#v ", l, lret)
|
||||
}
|
||||
|
||||
eret, err := client.TestEnum(thrifttest.Numberz_TWO)
|
||||
eret, err := client.TestEnum(defaultCtx, thrifttest.Numberz_TWO)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error in TestEnum() call: ", err)
|
||||
}
|
||||
@@ -207,7 +207,7 @@ func callEverything(client *thrifttest.ThriftTestClient) {
|
||||
t.Fatalf("Unexpected TestEnum() result expected %#v, got %#v ", thrifttest.Numberz_TWO, eret)
|
||||
}
|
||||
|
||||
tret, err := client.TestTypedef(thrifttest.UserId(42))
|
||||
tret, err := client.TestTypedef(defaultCtx, thrifttest.UserId(42))
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error in TestTypedef() call: ", err)
|
||||
}
|
||||
@@ -215,7 +215,7 @@ func callEverything(client *thrifttest.ThriftTestClient) {
|
||||
t.Fatalf("Unexpected TestTypedef() result expected %#v, got %#v ", thrifttest.UserId(42), tret)
|
||||
}
|
||||
|
||||
mapmap, err := client.TestMapMap(42)
|
||||
mapmap, err := client.TestMapMap(defaultCtx, 42)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error in TestMapMap() call: ", err)
|
||||
}
|
||||
@@ -242,7 +242,7 @@ func callEverything(client *thrifttest.ThriftTestClient) {
|
||||
truck1,
|
||||
truck2,
|
||||
}
|
||||
insanity, err := client.TestInsanity(crazy)
|
||||
insanity, err := client.TestInsanity(defaultCtx, crazy)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error in TestInsanity() call: ", err)
|
||||
}
|
||||
@@ -261,7 +261,7 @@ func callEverything(client *thrifttest.ThriftTestClient) {
|
||||
insanity[2][6])
|
||||
}
|
||||
|
||||
xxsret, err := client.TestMulti(42, 4242, 424242, map[int16]string{1: "blah", 2: "thing"}, thrifttest.Numberz_EIGHT, thrifttest.UserId(24))
|
||||
xxsret, err := client.TestMulti(defaultCtx, 42, 4242, 424242, map[int16]string{1: "blah", 2: "thing"}, thrifttest.Numberz_EIGHT, thrifttest.UserId(24))
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error in TestMulti() call: ", err)
|
||||
}
|
||||
@@ -269,7 +269,7 @@ func callEverything(client *thrifttest.ThriftTestClient) {
|
||||
t.Fatalf("Unexpected TestMulti() result expected %#v, got %#v ", xxs, xxsret)
|
||||
}
|
||||
|
||||
err = client.TestException("Xception")
|
||||
err = client.TestException(defaultCtx, "Xception")
|
||||
if err == nil {
|
||||
t.Fatalf("Expecting exception in TestException() call")
|
||||
}
|
||||
@@ -277,13 +277,13 @@ func callEverything(client *thrifttest.ThriftTestClient) {
|
||||
t.Fatalf("Unexpected TestException() result expected %#v, got %#v ", xcept, err)
|
||||
}
|
||||
|
||||
err = client.TestException("TException")
|
||||
err = client.TestException(defaultCtx, "TException")
|
||||
_, ok := err.(thrift.TApplicationException)
|
||||
if err == nil || !ok {
|
||||
t.Fatalf("Unexpected TestException() result expected ApplicationError, got %#v ", err)
|
||||
}
|
||||
|
||||
ign, err := client.TestMultiException("Xception", "ignoreme")
|
||||
ign, err := client.TestMultiException(defaultCtx, "Xception", "ignoreme")
|
||||
if ign != nil || err == nil {
|
||||
t.Fatalf("Expecting exception in TestMultiException() call")
|
||||
}
|
||||
@@ -291,7 +291,7 @@ func callEverything(client *thrifttest.ThriftTestClient) {
|
||||
t.Fatalf("Unexpected TestMultiException() %#v ", err)
|
||||
}
|
||||
|
||||
ign, err = client.TestMultiException("Xception2", "ignoreme")
|
||||
ign, err = client.TestMultiException(defaultCtx, "Xception2", "ignoreme")
|
||||
if ign != nil || err == nil {
|
||||
t.Fatalf("Expecting exception in TestMultiException() call")
|
||||
}
|
||||
@@ -301,13 +301,13 @@ func callEverything(client *thrifttest.ThriftTestClient) {
|
||||
t.Fatalf("Unexpected TestMultiException() %#v ", err)
|
||||
}
|
||||
|
||||
err = client.TestOneway(2)
|
||||
err = client.TestOneway(defaultCtx, 2)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error in TestOneway() call: ", err)
|
||||
}
|
||||
|
||||
//Make sure the connection still alive
|
||||
if err = client.TestVoid(); err != nil {
|
||||
if err = client.TestVoid(defaultCtx); err != nil {
|
||||
t.Fatalf("Unexpected error in TestVoid() call: ", err)
|
||||
}
|
||||
}
|
||||
|
||||
26
vendor/github.com/apache/thrift/test/go/src/bin/testclient/pre_go17.go
generated
vendored
Normal file
26
vendor/github.com/apache/thrift/test/go/src/bin/testclient/pre_go17.go
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
// +build !go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import "golang.org/x/net/context"
|
||||
|
||||
var defaultCtx = context.Background()
|
||||
96
vendor/github.com/apache/thrift/test/go/src/common/clientserver_test.go
generated
vendored
96
vendor/github.com/apache/thrift/test/go/src/common/clientserver_test.go
generated
vendored
@@ -92,39 +92,39 @@ var xcept = &thrifttest.Xception{ErrorCode: 1001, Message: "some"}
|
||||
|
||||
func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, handler *MockThriftTest) {
|
||||
gomock.InOrder(
|
||||
handler.EXPECT().TestVoid(),
|
||||
handler.EXPECT().TestString("thing").Return("thing", nil),
|
||||
handler.EXPECT().TestBool(true).Return(true, nil),
|
||||
handler.EXPECT().TestBool(false).Return(false, nil),
|
||||
handler.EXPECT().TestByte(int8(42)).Return(int8(42), nil),
|
||||
handler.EXPECT().TestI32(int32(4242)).Return(int32(4242), nil),
|
||||
handler.EXPECT().TestI64(int64(424242)).Return(int64(424242), nil),
|
||||
handler.EXPECT().TestVoid(gomock.Any()),
|
||||
handler.EXPECT().TestString(gomock.Any(), "thing").Return("thing", nil),
|
||||
handler.EXPECT().TestBool(gomock.Any(), true).Return(true, nil),
|
||||
handler.EXPECT().TestBool(gomock.Any(), false).Return(false, nil),
|
||||
handler.EXPECT().TestByte(gomock.Any(), int8(42)).Return(int8(42), nil),
|
||||
handler.EXPECT().TestI32(gomock.Any(), int32(4242)).Return(int32(4242), nil),
|
||||
handler.EXPECT().TestI64(gomock.Any(), int64(424242)).Return(int64(424242), nil),
|
||||
// TODO: add TestBinary()
|
||||
handler.EXPECT().TestDouble(float64(42.42)).Return(float64(42.42), nil),
|
||||
handler.EXPECT().TestStruct(&thrifttest.Xtruct{StringThing: "thing", ByteThing: 42, I32Thing: 4242, I64Thing: 424242}).Return(&thrifttest.Xtruct{StringThing: "thing", ByteThing: 42, I32Thing: 4242, I64Thing: 424242}, nil),
|
||||
handler.EXPECT().TestNest(&thrifttest.Xtruct2{StructThing: &thrifttest.Xtruct{StringThing: "thing", ByteThing: 42, I32Thing: 4242, I64Thing: 424242}}).Return(&thrifttest.Xtruct2{StructThing: &thrifttest.Xtruct{StringThing: "thing", ByteThing: 42, I32Thing: 4242, I64Thing: 424242}}, nil),
|
||||
handler.EXPECT().TestMap(map[int32]int32{1: 2, 3: 4, 5: 42}).Return(map[int32]int32{1: 2, 3: 4, 5: 42}, nil),
|
||||
handler.EXPECT().TestStringMap(map[string]string{"a": "2", "b": "blah", "some": "thing"}).Return(map[string]string{"a": "2", "b": "blah", "some": "thing"}, nil),
|
||||
handler.EXPECT().TestSet([]int32{1, 2, 42}).Return([]int32{1, 2, 42}, nil),
|
||||
handler.EXPECT().TestList([]int32{1, 2, 42}).Return([]int32{1, 2, 42}, nil),
|
||||
handler.EXPECT().TestEnum(thrifttest.Numberz_TWO).Return(thrifttest.Numberz_TWO, nil),
|
||||
handler.EXPECT().TestTypedef(thrifttest.UserId(42)).Return(thrifttest.UserId(42), nil),
|
||||
handler.EXPECT().TestMapMap(int32(42)).Return(rmapmap, nil),
|
||||
handler.EXPECT().TestDouble(gomock.Any(), float64(42.42)).Return(float64(42.42), nil),
|
||||
handler.EXPECT().TestStruct(gomock.Any(), &thrifttest.Xtruct{StringThing: "thing", ByteThing: 42, I32Thing: 4242, I64Thing: 424242}).Return(&thrifttest.Xtruct{StringThing: "thing", ByteThing: 42, I32Thing: 4242, I64Thing: 424242}, nil),
|
||||
handler.EXPECT().TestNest(gomock.Any(), &thrifttest.Xtruct2{StructThing: &thrifttest.Xtruct{StringThing: "thing", ByteThing: 42, I32Thing: 4242, I64Thing: 424242}}).Return(&thrifttest.Xtruct2{StructThing: &thrifttest.Xtruct{StringThing: "thing", ByteThing: 42, I32Thing: 4242, I64Thing: 424242}}, nil),
|
||||
handler.EXPECT().TestMap(gomock.Any(), map[int32]int32{1: 2, 3: 4, 5: 42}).Return(map[int32]int32{1: 2, 3: 4, 5: 42}, nil),
|
||||
handler.EXPECT().TestStringMap(gomock.Any(), map[string]string{"a": "2", "b": "blah", "some": "thing"}).Return(map[string]string{"a": "2", "b": "blah", "some": "thing"}, nil),
|
||||
handler.EXPECT().TestSet(gomock.Any(), []int32{1, 2, 42}).Return([]int32{1, 2, 42}, nil),
|
||||
handler.EXPECT().TestList(gomock.Any(), []int32{1, 2, 42}).Return([]int32{1, 2, 42}, nil),
|
||||
handler.EXPECT().TestEnum(gomock.Any(), thrifttest.Numberz_TWO).Return(thrifttest.Numberz_TWO, nil),
|
||||
handler.EXPECT().TestTypedef(gomock.Any(), thrifttest.UserId(42)).Return(thrifttest.UserId(42), nil),
|
||||
handler.EXPECT().TestMapMap(gomock.Any(), int32(42)).Return(rmapmap, nil),
|
||||
// TODO: not testing insanity
|
||||
handler.EXPECT().TestMulti(int8(42), int32(4242), int64(424242), map[int16]string{1: "blah", 2: "thing"}, thrifttest.Numberz_EIGHT, thrifttest.UserId(24)).Return(xxs, nil),
|
||||
handler.EXPECT().TestException("some").Return(xcept),
|
||||
handler.EXPECT().TestException("TException").Return(errors.New("Just random exception")),
|
||||
handler.EXPECT().TestMultiException("Xception", "ignoreme").Return(nil, &thrifttest.Xception{ErrorCode: 1001, Message: "This is an Xception"}),
|
||||
handler.EXPECT().TestMultiException("Xception2", "ignoreme").Return(nil, &thrifttest.Xception2{ErrorCode: 2002, StructThing: &thrifttest.Xtruct{StringThing: "This is an Xception2"}}),
|
||||
handler.EXPECT().TestOneway(int32(2)).Return(nil),
|
||||
handler.EXPECT().TestVoid(),
|
||||
handler.EXPECT().TestMulti(gomock.Any(), int8(42), int32(4242), int64(424242), map[int16]string{1: "blah", 2: "thing"}, thrifttest.Numberz_EIGHT, thrifttest.UserId(24)).Return(xxs, nil),
|
||||
handler.EXPECT().TestException(gomock.Any(), "some").Return(xcept),
|
||||
handler.EXPECT().TestException(gomock.Any(), "TException").Return(errors.New("Just random exception")),
|
||||
handler.EXPECT().TestMultiException(gomock.Any(), "Xception", "ignoreme").Return(nil, &thrifttest.Xception{ErrorCode: 1001, Message: "This is an Xception"}),
|
||||
handler.EXPECT().TestMultiException(gomock.Any(), "Xception2", "ignoreme").Return(nil, &thrifttest.Xception2{ErrorCode: 2002, StructThing: &thrifttest.Xtruct{StringThing: "This is an Xception2"}}),
|
||||
handler.EXPECT().TestOneway(gomock.Any(), int32(2)).Return(nil),
|
||||
handler.EXPECT().TestVoid(gomock.Any()),
|
||||
)
|
||||
var err error
|
||||
if err = client.TestVoid(); err != nil {
|
||||
if err = client.TestVoid(defaultCtx); err != nil {
|
||||
t.Errorf("Unexpected error in TestVoid() call: ", err)
|
||||
}
|
||||
|
||||
thing, err := client.TestString("thing")
|
||||
thing, err := client.TestString(defaultCtx, "thing")
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error in TestString() call: ", err)
|
||||
}
|
||||
@@ -132,14 +132,14 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h
|
||||
t.Errorf("Unexpected TestString() result, expected 'thing' got '%s' ", thing)
|
||||
}
|
||||
|
||||
bl, err := client.TestBool(true)
|
||||
bl, err := client.TestBool(defaultCtx, true)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error in TestBool() call: ", err)
|
||||
}
|
||||
if !bl {
|
||||
t.Errorf("Unexpected TestBool() result expected true, got %f ", bl)
|
||||
}
|
||||
bl, err = client.TestBool(false)
|
||||
bl, err = client.TestBool(defaultCtx, false)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error in TestBool() call: ", err)
|
||||
}
|
||||
@@ -147,7 +147,7 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h
|
||||
t.Errorf("Unexpected TestBool() result expected false, got %f ", bl)
|
||||
}
|
||||
|
||||
b, err := client.TestByte(42)
|
||||
b, err := client.TestByte(defaultCtx, 42)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error in TestByte() call: ", err)
|
||||
}
|
||||
@@ -155,7 +155,7 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h
|
||||
t.Errorf("Unexpected TestByte() result expected 42, got %d ", b)
|
||||
}
|
||||
|
||||
i32, err := client.TestI32(4242)
|
||||
i32, err := client.TestI32(defaultCtx, 4242)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error in TestI32() call: ", err)
|
||||
}
|
||||
@@ -163,7 +163,7 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h
|
||||
t.Errorf("Unexpected TestI32() result expected 4242, got %d ", i32)
|
||||
}
|
||||
|
||||
i64, err := client.TestI64(424242)
|
||||
i64, err := client.TestI64(defaultCtx, 424242)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error in TestI64() call: ", err)
|
||||
}
|
||||
@@ -171,7 +171,7 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h
|
||||
t.Errorf("Unexpected TestI64() result expected 424242, got %d ", i64)
|
||||
}
|
||||
|
||||
d, err := client.TestDouble(42.42)
|
||||
d, err := client.TestDouble(defaultCtx, 42.42)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error in TestDouble() call: ", err)
|
||||
}
|
||||
@@ -186,7 +186,7 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h
|
||||
xs.ByteThing = 42
|
||||
xs.I32Thing = 4242
|
||||
xs.I64Thing = 424242
|
||||
xsret, err := client.TestStruct(xs)
|
||||
xsret, err := client.TestStruct(defaultCtx, xs)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error in TestStruct() call: ", err)
|
||||
}
|
||||
@@ -196,7 +196,7 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h
|
||||
|
||||
x2 := thrifttest.NewXtruct2()
|
||||
x2.StructThing = xs
|
||||
x2ret, err := client.TestNest(x2)
|
||||
x2ret, err := client.TestNest(defaultCtx, x2)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error in TestNest() call: ", err)
|
||||
}
|
||||
@@ -205,7 +205,7 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h
|
||||
}
|
||||
|
||||
m := map[int32]int32{1: 2, 3: 4, 5: 42}
|
||||
mret, err := client.TestMap(m)
|
||||
mret, err := client.TestMap(defaultCtx, m)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error in TestMap() call: ", err)
|
||||
}
|
||||
@@ -214,7 +214,7 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h
|
||||
}
|
||||
|
||||
sm := map[string]string{"a": "2", "b": "blah", "some": "thing"}
|
||||
smret, err := client.TestStringMap(sm)
|
||||
smret, err := client.TestStringMap(defaultCtx, sm)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error in TestStringMap() call: ", err)
|
||||
}
|
||||
@@ -223,7 +223,7 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h
|
||||
}
|
||||
|
||||
s := []int32{1, 2, 42}
|
||||
sret, err := client.TestSet(s)
|
||||
sret, err := client.TestSet(defaultCtx, s)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error in TestSet() call: ", err)
|
||||
}
|
||||
@@ -239,7 +239,7 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h
|
||||
}
|
||||
|
||||
l := []int32{1, 2, 42}
|
||||
lret, err := client.TestList(l)
|
||||
lret, err := client.TestList(defaultCtx, l)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error in TestList() call: ", err)
|
||||
}
|
||||
@@ -247,7 +247,7 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h
|
||||
t.Errorf("Unexpected TestList() result expected %#v, got %#v ", l, lret)
|
||||
}
|
||||
|
||||
eret, err := client.TestEnum(thrifttest.Numberz_TWO)
|
||||
eret, err := client.TestEnum(defaultCtx, thrifttest.Numberz_TWO)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error in TestEnum() call: ", err)
|
||||
}
|
||||
@@ -255,7 +255,7 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h
|
||||
t.Errorf("Unexpected TestEnum() result expected %#v, got %#v ", thrifttest.Numberz_TWO, eret)
|
||||
}
|
||||
|
||||
tret, err := client.TestTypedef(thrifttest.UserId(42))
|
||||
tret, err := client.TestTypedef(defaultCtx, thrifttest.UserId(42))
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error in TestTypedef() call: ", err)
|
||||
}
|
||||
@@ -263,7 +263,7 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h
|
||||
t.Errorf("Unexpected TestTypedef() result expected %#v, got %#v ", thrifttest.UserId(42), tret)
|
||||
}
|
||||
|
||||
mapmap, err := client.TestMapMap(42)
|
||||
mapmap, err := client.TestMapMap(defaultCtx, 42)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error in TestMapmap() call: ", err)
|
||||
}
|
||||
@@ -271,7 +271,7 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h
|
||||
t.Errorf("Unexpected TestMapmap() result expected %#v, got %#v ", rmapmap, mapmap)
|
||||
}
|
||||
|
||||
xxsret, err := client.TestMulti(42, 4242, 424242, map[int16]string{1: "blah", 2: "thing"}, thrifttest.Numberz_EIGHT, thrifttest.UserId(24))
|
||||
xxsret, err := client.TestMulti(defaultCtx, 42, 4242, 424242, map[int16]string{1: "blah", 2: "thing"}, thrifttest.Numberz_EIGHT, thrifttest.UserId(24))
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error in TestMulti() call: ", err)
|
||||
}
|
||||
@@ -279,7 +279,7 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h
|
||||
t.Errorf("Unexpected TestMulti() result expected %#v, got %#v ", xxs, xxsret)
|
||||
}
|
||||
|
||||
err = client.TestException("some")
|
||||
err = client.TestException(defaultCtx, "some")
|
||||
if err == nil {
|
||||
t.Errorf("Expecting exception in TestException() call")
|
||||
}
|
||||
@@ -288,13 +288,13 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h
|
||||
}
|
||||
|
||||
// TODO: connection is being closed on this
|
||||
err = client.TestException("TException")
|
||||
err = client.TestException(defaultCtx, "TException")
|
||||
tex, ok := err.(thrift.TApplicationException)
|
||||
if err == nil || !ok || tex.TypeId() != thrift.INTERNAL_ERROR {
|
||||
t.Errorf("Unexpected TestException() result expected ApplicationError, got %#v ", err)
|
||||
}
|
||||
|
||||
ign, err := client.TestMultiException("Xception", "ignoreme")
|
||||
ign, err := client.TestMultiException(defaultCtx, "Xception", "ignoreme")
|
||||
if ign != nil || err == nil {
|
||||
t.Errorf("Expecting exception in TestMultiException() call")
|
||||
}
|
||||
@@ -302,7 +302,7 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h
|
||||
t.Errorf("Unexpected TestMultiException() %#v ", err)
|
||||
}
|
||||
|
||||
ign, err = client.TestMultiException("Xception2", "ignoreme")
|
||||
ign, err = client.TestMultiException(defaultCtx, "Xception2", "ignoreme")
|
||||
if ign != nil || err == nil {
|
||||
t.Errorf("Expecting exception in TestMultiException() call")
|
||||
}
|
||||
@@ -312,13 +312,13 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h
|
||||
t.Errorf("Unexpected TestMultiException() %#v ", err)
|
||||
}
|
||||
|
||||
err = client.TestOneway(2)
|
||||
err = client.TestOneway(defaultCtx, 2)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error in TestOneway() call: ", err)
|
||||
}
|
||||
|
||||
//Make sure the connection still alive
|
||||
if err = client.TestVoid(); err != nil {
|
||||
if err = client.TestVoid(defaultCtx); err != nil {
|
||||
t.Errorf("Unexpected error in TestVoid() call: ", err)
|
||||
}
|
||||
}
|
||||
|
||||
26
vendor/github.com/apache/thrift/test/go/src/common/go17.go
generated
vendored
Normal file
26
vendor/github.com/apache/thrift/test/go/src/common/go17.go
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
// +build go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package common
|
||||
|
||||
import "context"
|
||||
|
||||
var defaultCtx = context.Background()
|
||||
280
vendor/github.com/apache/thrift/test/go/src/common/mock_handler.go
generated
vendored
280
vendor/github.com/apache/thrift/test/go/src/common/mock_handler.go
generated
vendored
@@ -23,267 +23,313 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
thrifttest "gen/thrifttest"
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
context "golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// Mock of ThriftTest interface
|
||||
// MockThriftTest is a mock of ThriftTest interface
|
||||
type MockThriftTest struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *_MockThriftTestRecorder
|
||||
recorder *MockThriftTestMockRecorder
|
||||
}
|
||||
|
||||
// Recorder for MockThriftTest (not exported)
|
||||
type _MockThriftTestRecorder struct {
|
||||
// MockThriftTestMockRecorder is the mock recorder for MockThriftTest
|
||||
type MockThriftTestMockRecorder struct {
|
||||
mock *MockThriftTest
|
||||
}
|
||||
|
||||
// NewMockThriftTest creates a new mock instance
|
||||
func NewMockThriftTest(ctrl *gomock.Controller) *MockThriftTest {
|
||||
mock := &MockThriftTest{ctrl: ctrl}
|
||||
mock.recorder = &_MockThriftTestRecorder{mock}
|
||||
mock.recorder = &MockThriftTestMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
func (_m *MockThriftTest) EXPECT() *_MockThriftTestRecorder {
|
||||
// EXPECT returns an object that allows the caller to indicate expected use
|
||||
func (_m *MockThriftTest) EXPECT() *MockThriftTestMockRecorder {
|
||||
return _m.recorder
|
||||
}
|
||||
|
||||
func (_m *MockThriftTest) TestBool(_param0 bool) (bool, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestBool", _param0)
|
||||
ret0, _ := ret[0].(bool)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
func (_mr *_MockThriftTestRecorder) TestBool(arg0 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestBool", arg0)
|
||||
}
|
||||
|
||||
|
||||
func (_m *MockThriftTest) TestByte(_param0 int8) (int8, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestByte", _param0)
|
||||
ret0, _ := ret[0].(int8)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
func (_mr *_MockThriftTestRecorder) TestByte(arg0 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestByte", arg0)
|
||||
}
|
||||
|
||||
func (_m *MockThriftTest) TestDouble(_param0 float64) (float64, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestDouble", _param0)
|
||||
ret0, _ := ret[0].(float64)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
func (_mr *_MockThriftTestRecorder) TestDouble(arg0 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestDouble", arg0)
|
||||
}
|
||||
|
||||
func (_m *MockThriftTest) TestBinary(_param0 []byte) ([]byte, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestBinary", _param0)
|
||||
// TestBinary mocks base method
|
||||
func (_m *MockThriftTest) TestBinary(_param0 context.Context, _param1 []byte) ([]byte, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestBinary", _param0, _param1)
|
||||
ret0, _ := ret[0].([]byte)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
func (_mr *_MockThriftTestRecorder) TestBinary(arg0 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestBinary", arg0)
|
||||
// TestBinary indicates an expected call of TestBinary
|
||||
func (_mr *MockThriftTestMockRecorder) TestBinary(arg0, arg1 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestBinary", arg0, arg1)
|
||||
}
|
||||
|
||||
func (_m *MockThriftTest) TestEnum(_param0 thrifttest.Numberz) (thrifttest.Numberz, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestEnum", _param0)
|
||||
// TestBool mocks base method
|
||||
func (_m *MockThriftTest) TestBool(_param0 context.Context, _param1 bool) (bool, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestBool", _param0, _param1)
|
||||
ret0, _ := ret[0].(bool)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// TestBool indicates an expected call of TestBool
|
||||
func (_mr *MockThriftTestMockRecorder) TestBool(arg0, arg1 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestBool", arg0, arg1)
|
||||
}
|
||||
|
||||
// TestByte mocks base method
|
||||
func (_m *MockThriftTest) TestByte(_param0 context.Context, _param1 int8) (int8, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestByte", _param0, _param1)
|
||||
ret0, _ := ret[0].(int8)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// TestByte indicates an expected call of TestByte
|
||||
func (_mr *MockThriftTestMockRecorder) TestByte(arg0, arg1 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestByte", arg0, arg1)
|
||||
}
|
||||
|
||||
// TestDouble mocks base method
|
||||
func (_m *MockThriftTest) TestDouble(_param0 context.Context, _param1 float64) (float64, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestDouble", _param0, _param1)
|
||||
ret0, _ := ret[0].(float64)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// TestDouble indicates an expected call of TestDouble
|
||||
func (_mr *MockThriftTestMockRecorder) TestDouble(arg0, arg1 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestDouble", arg0, arg1)
|
||||
}
|
||||
|
||||
// TestEnum mocks base method
|
||||
func (_m *MockThriftTest) TestEnum(_param0 context.Context, _param1 thrifttest.Numberz) (thrifttest.Numberz, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestEnum", _param0, _param1)
|
||||
ret0, _ := ret[0].(thrifttest.Numberz)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
func (_mr *_MockThriftTestRecorder) TestEnum(arg0 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestEnum", arg0)
|
||||
// TestEnum indicates an expected call of TestEnum
|
||||
func (_mr *MockThriftTestMockRecorder) TestEnum(arg0, arg1 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestEnum", arg0, arg1)
|
||||
}
|
||||
|
||||
func (_m *MockThriftTest) TestException(_param0 string) error {
|
||||
ret := _m.ctrl.Call(_m, "TestException", _param0)
|
||||
// TestException mocks base method
|
||||
func (_m *MockThriftTest) TestException(_param0 context.Context, _param1 string) error {
|
||||
ret := _m.ctrl.Call(_m, "TestException", _param0, _param1)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
func (_mr *_MockThriftTestRecorder) TestException(arg0 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestException", arg0)
|
||||
// TestException indicates an expected call of TestException
|
||||
func (_mr *MockThriftTestMockRecorder) TestException(arg0, arg1 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestException", arg0, arg1)
|
||||
}
|
||||
|
||||
func (_m *MockThriftTest) TestI32(_param0 int32) (int32, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestI32", _param0)
|
||||
// TestI32 mocks base method
|
||||
func (_m *MockThriftTest) TestI32(_param0 context.Context, _param1 int32) (int32, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestI32", _param0, _param1)
|
||||
ret0, _ := ret[0].(int32)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
func (_mr *_MockThriftTestRecorder) TestI32(arg0 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestI32", arg0)
|
||||
// TestI32 indicates an expected call of TestI32
|
||||
func (_mr *MockThriftTestMockRecorder) TestI32(arg0, arg1 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestI32", arg0, arg1)
|
||||
}
|
||||
|
||||
func (_m *MockThriftTest) TestI64(_param0 int64) (int64, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestI64", _param0)
|
||||
// TestI64 mocks base method
|
||||
func (_m *MockThriftTest) TestI64(_param0 context.Context, _param1 int64) (int64, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestI64", _param0, _param1)
|
||||
ret0, _ := ret[0].(int64)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
func (_mr *_MockThriftTestRecorder) TestI64(arg0 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestI64", arg0)
|
||||
// TestI64 indicates an expected call of TestI64
|
||||
func (_mr *MockThriftTestMockRecorder) TestI64(arg0, arg1 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestI64", arg0, arg1)
|
||||
}
|
||||
|
||||
func (_m *MockThriftTest) TestInsanity(_param0 *thrifttest.Insanity) (map[thrifttest.UserId]map[thrifttest.Numberz]*thrifttest.Insanity, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestInsanity", _param0)
|
||||
// TestInsanity mocks base method
|
||||
func (_m *MockThriftTest) TestInsanity(_param0 context.Context, _param1 *thrifttest.Insanity) (map[thrifttest.UserId]map[thrifttest.Numberz]*thrifttest.Insanity, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestInsanity", _param0, _param1)
|
||||
ret0, _ := ret[0].(map[thrifttest.UserId]map[thrifttest.Numberz]*thrifttest.Insanity)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
func (_mr *_MockThriftTestRecorder) TestInsanity(arg0 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestInsanity", arg0)
|
||||
// TestInsanity indicates an expected call of TestInsanity
|
||||
func (_mr *MockThriftTestMockRecorder) TestInsanity(arg0, arg1 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestInsanity", arg0, arg1)
|
||||
}
|
||||
|
||||
func (_m *MockThriftTest) TestList(_param0 []int32) ([]int32, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestList", _param0)
|
||||
// TestList mocks base method
|
||||
func (_m *MockThriftTest) TestList(_param0 context.Context, _param1 []int32) ([]int32, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestList", _param0, _param1)
|
||||
ret0, _ := ret[0].([]int32)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
func (_mr *_MockThriftTestRecorder) TestList(arg0 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestList", arg0)
|
||||
// TestList indicates an expected call of TestList
|
||||
func (_mr *MockThriftTestMockRecorder) TestList(arg0, arg1 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestList", arg0, arg1)
|
||||
}
|
||||
|
||||
func (_m *MockThriftTest) TestMap(_param0 map[int32]int32) (map[int32]int32, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestMap", _param0)
|
||||
// TestMap mocks base method
|
||||
func (_m *MockThriftTest) TestMap(_param0 context.Context, _param1 map[int32]int32) (map[int32]int32, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestMap", _param0, _param1)
|
||||
ret0, _ := ret[0].(map[int32]int32)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
func (_mr *_MockThriftTestRecorder) TestMap(arg0 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestMap", arg0)
|
||||
// TestMap indicates an expected call of TestMap
|
||||
func (_mr *MockThriftTestMockRecorder) TestMap(arg0, arg1 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestMap", arg0, arg1)
|
||||
}
|
||||
|
||||
func (_m *MockThriftTest) TestMapMap(_param0 int32) (map[int32]map[int32]int32, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestMapMap", _param0)
|
||||
// TestMapMap mocks base method
|
||||
func (_m *MockThriftTest) TestMapMap(_param0 context.Context, _param1 int32) (map[int32]map[int32]int32, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestMapMap", _param0, _param1)
|
||||
ret0, _ := ret[0].(map[int32]map[int32]int32)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
func (_mr *_MockThriftTestRecorder) TestMapMap(arg0 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestMapMap", arg0)
|
||||
// TestMapMap indicates an expected call of TestMapMap
|
||||
func (_mr *MockThriftTestMockRecorder) TestMapMap(arg0, arg1 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestMapMap", arg0, arg1)
|
||||
}
|
||||
|
||||
func (_m *MockThriftTest) TestMulti(_param0 int8, _param1 int32, _param2 int64, _param3 map[int16]string, _param4 thrifttest.Numberz, _param5 thrifttest.UserId) (*thrifttest.Xtruct, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestMulti", _param0, _param1, _param2, _param3, _param4, _param5)
|
||||
// TestMulti mocks base method
|
||||
func (_m *MockThriftTest) TestMulti(_param0 context.Context, _param1 int8, _param2 int32, _param3 int64, _param4 map[int16]string, _param5 thrifttest.Numberz, _param6 thrifttest.UserId) (*thrifttest.Xtruct, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestMulti", _param0, _param1, _param2, _param3, _param4, _param5, _param6)
|
||||
ret0, _ := ret[0].(*thrifttest.Xtruct)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
func (_mr *_MockThriftTestRecorder) TestMulti(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestMulti", arg0, arg1, arg2, arg3, arg4, arg5)
|
||||
// TestMulti indicates an expected call of TestMulti
|
||||
func (_mr *MockThriftTestMockRecorder) TestMulti(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestMulti", arg0, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
}
|
||||
|
||||
func (_m *MockThriftTest) TestMultiException(_param0 string, _param1 string) (*thrifttest.Xtruct, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestMultiException", _param0, _param1)
|
||||
// TestMultiException mocks base method
|
||||
func (_m *MockThriftTest) TestMultiException(_param0 context.Context, _param1 string, _param2 string) (*thrifttest.Xtruct, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestMultiException", _param0, _param1, _param2)
|
||||
ret0, _ := ret[0].(*thrifttest.Xtruct)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
func (_mr *_MockThriftTestRecorder) TestMultiException(arg0, arg1 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestMultiException", arg0, arg1)
|
||||
// TestMultiException indicates an expected call of TestMultiException
|
||||
func (_mr *MockThriftTestMockRecorder) TestMultiException(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestMultiException", arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
func (_m *MockThriftTest) TestNest(_param0 *thrifttest.Xtruct2) (*thrifttest.Xtruct2, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestNest", _param0)
|
||||
// TestNest mocks base method
|
||||
func (_m *MockThriftTest) TestNest(_param0 context.Context, _param1 *thrifttest.Xtruct2) (*thrifttest.Xtruct2, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestNest", _param0, _param1)
|
||||
ret0, _ := ret[0].(*thrifttest.Xtruct2)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
func (_mr *_MockThriftTestRecorder) TestNest(arg0 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestNest", arg0)
|
||||
// TestNest indicates an expected call of TestNest
|
||||
func (_mr *MockThriftTestMockRecorder) TestNest(arg0, arg1 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestNest", arg0, arg1)
|
||||
}
|
||||
|
||||
func (_m *MockThriftTest) TestOneway(_param0 int32) error {
|
||||
ret := _m.ctrl.Call(_m, "TestOneway", _param0)
|
||||
// TestOneway mocks base method
|
||||
func (_m *MockThriftTest) TestOneway(_param0 context.Context, _param1 int32) error {
|
||||
ret := _m.ctrl.Call(_m, "TestOneway", _param0, _param1)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
func (_mr *_MockThriftTestRecorder) TestOneway(arg0 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestOneway", arg0)
|
||||
// TestOneway indicates an expected call of TestOneway
|
||||
func (_mr *MockThriftTestMockRecorder) TestOneway(arg0, arg1 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestOneway", arg0, arg1)
|
||||
}
|
||||
|
||||
func (_m *MockThriftTest) TestSet(_param0 []int32) ([]int32, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestSet", _param0)
|
||||
// TestSet mocks base method
|
||||
func (_m *MockThriftTest) TestSet(_param0 context.Context, _param1 []int32) ([]int32, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestSet", _param0, _param1)
|
||||
ret0, _ := ret[0].([]int32)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
func (_mr *_MockThriftTestRecorder) TestSet(arg0 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestSet", arg0)
|
||||
// TestSet indicates an expected call of TestSet
|
||||
func (_mr *MockThriftTestMockRecorder) TestSet(arg0, arg1 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestSet", arg0, arg1)
|
||||
}
|
||||
|
||||
func (_m *MockThriftTest) TestString(_param0 string) (string, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestString", _param0)
|
||||
// TestString mocks base method
|
||||
func (_m *MockThriftTest) TestString(_param0 context.Context, _param1 string) (string, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestString", _param0, _param1)
|
||||
ret0, _ := ret[0].(string)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
func (_mr *_MockThriftTestRecorder) TestString(arg0 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestString", arg0)
|
||||
// TestString indicates an expected call of TestString
|
||||
func (_mr *MockThriftTestMockRecorder) TestString(arg0, arg1 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestString", arg0, arg1)
|
||||
}
|
||||
|
||||
func (_m *MockThriftTest) TestStringMap(_param0 map[string]string) (map[string]string, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestStringMap", _param0)
|
||||
// TestStringMap mocks base method
|
||||
func (_m *MockThriftTest) TestStringMap(_param0 context.Context, _param1 map[string]string) (map[string]string, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestStringMap", _param0, _param1)
|
||||
ret0, _ := ret[0].(map[string]string)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
func (_mr *_MockThriftTestRecorder) TestStringMap(arg0 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestStringMap", arg0)
|
||||
// TestStringMap indicates an expected call of TestStringMap
|
||||
func (_mr *MockThriftTestMockRecorder) TestStringMap(arg0, arg1 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestStringMap", arg0, arg1)
|
||||
}
|
||||
|
||||
func (_m *MockThriftTest) TestStruct(_param0 *thrifttest.Xtruct) (*thrifttest.Xtruct, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestStruct", _param0)
|
||||
// TestStruct mocks base method
|
||||
func (_m *MockThriftTest) TestStruct(_param0 context.Context, _param1 *thrifttest.Xtruct) (*thrifttest.Xtruct, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestStruct", _param0, _param1)
|
||||
ret0, _ := ret[0].(*thrifttest.Xtruct)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
func (_mr *_MockThriftTestRecorder) TestStruct(arg0 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestStruct", arg0)
|
||||
// TestStruct indicates an expected call of TestStruct
|
||||
func (_mr *MockThriftTestMockRecorder) TestStruct(arg0, arg1 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestStruct", arg0, arg1)
|
||||
}
|
||||
|
||||
func (_m *MockThriftTest) TestTypedef(_param0 thrifttest.UserId) (thrifttest.UserId, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestTypedef", _param0)
|
||||
// TestTypedef mocks base method
|
||||
func (_m *MockThriftTest) TestTypedef(_param0 context.Context, _param1 thrifttest.UserId) (thrifttest.UserId, error) {
|
||||
ret := _m.ctrl.Call(_m, "TestTypedef", _param0, _param1)
|
||||
ret0, _ := ret[0].(thrifttest.UserId)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
func (_mr *_MockThriftTestRecorder) TestTypedef(arg0 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestTypedef", arg0)
|
||||
// TestTypedef indicates an expected call of TestTypedef
|
||||
func (_mr *MockThriftTestMockRecorder) TestTypedef(arg0, arg1 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestTypedef", arg0, arg1)
|
||||
}
|
||||
|
||||
func (_m *MockThriftTest) TestVoid() error {
|
||||
ret := _m.ctrl.Call(_m, "TestVoid")
|
||||
// TestVoid mocks base method
|
||||
func (_m *MockThriftTest) TestVoid(_param0 context.Context) error {
|
||||
ret := _m.ctrl.Call(_m, "TestVoid", _param0)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
func (_mr *_MockThriftTestRecorder) TestVoid() *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestVoid")
|
||||
// TestVoid indicates an expected call of TestVoid
|
||||
func (_mr *MockThriftTestMockRecorder) TestVoid(arg0 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestVoid", arg0)
|
||||
}
|
||||
|
||||
26
vendor/github.com/apache/thrift/test/go/src/common/pre_go17.go
generated
vendored
Normal file
26
vendor/github.com/apache/thrift/test/go/src/common/pre_go17.go
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
// +build !go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package common
|
||||
|
||||
import "golang.org/x/net/context"
|
||||
|
||||
var defaultCtx = context.Background()
|
||||
48
vendor/github.com/apache/thrift/test/go/src/common/printing_handler.go
generated
vendored
48
vendor/github.com/apache/thrift/test/go/src/common/printing_handler.go
generated
vendored
@@ -1,3 +1,5 @@
|
||||
// +build !go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
@@ -25,6 +27,8 @@ import (
|
||||
"encoding/hex"
|
||||
. "gen/thrifttest"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
var PrintingHandler = &printingHandler{}
|
||||
@@ -32,7 +36,7 @@ var PrintingHandler = &printingHandler{}
|
||||
type printingHandler struct{}
|
||||
|
||||
// Prints "testVoid()" and returns nothing.
|
||||
func (p *printingHandler) TestVoid() (err error) {
|
||||
func (p *printingHandler) TestVoid(ctx context.Context) (err error) {
|
||||
fmt.Println("testVoid()")
|
||||
return nil
|
||||
}
|
||||
@@ -43,7 +47,7 @@ func (p *printingHandler) TestVoid() (err error) {
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestString(thing string) (r string, err error) {
|
||||
func (p *printingHandler) TestString(ctx context.Context, thing string) (r string, err error) {
|
||||
fmt.Printf("testString(\"%s\")\n", thing)
|
||||
return thing, nil
|
||||
}
|
||||
@@ -54,7 +58,7 @@ func (p *printingHandler) TestString(thing string) (r string, err error) {
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestBool(thing bool) (r bool, err error) {
|
||||
func (p *printingHandler) TestBool(ctx context.Context, thing bool) (r bool, err error) {
|
||||
fmt.Printf("testBool(%t)\n", thing)
|
||||
return thing, nil
|
||||
}
|
||||
@@ -65,7 +69,7 @@ func (p *printingHandler) TestBool(thing bool) (r bool, err error) {
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestByte(thing int8) (r int8, err error) {
|
||||
func (p *printingHandler) TestByte(ctx context.Context, thing int8) (r int8, err error) {
|
||||
fmt.Printf("testByte(%d)\n", thing)
|
||||
return thing, nil
|
||||
}
|
||||
@@ -76,7 +80,7 @@ func (p *printingHandler) TestByte(thing int8) (r int8, err error) {
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestI32(thing int32) (r int32, err error) {
|
||||
func (p *printingHandler) TestI32(ctx context.Context, thing int32) (r int32, err error) {
|
||||
fmt.Printf("testI32(%d)\n", thing)
|
||||
return thing, nil
|
||||
}
|
||||
@@ -87,7 +91,7 @@ func (p *printingHandler) TestI32(thing int32) (r int32, err error) {
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestI64(thing int64) (r int64, err error) {
|
||||
func (p *printingHandler) TestI64(ctx context.Context, thing int64) (r int64, err error) {
|
||||
fmt.Printf("testI64(%d)\n", thing)
|
||||
return thing, nil
|
||||
}
|
||||
@@ -98,7 +102,7 @@ func (p *printingHandler) TestI64(thing int64) (r int64, err error) {
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestDouble(thing float64) (r float64, err error) {
|
||||
func (p *printingHandler) TestDouble(ctx context.Context, thing float64) (r float64, err error) {
|
||||
fmt.Printf("testDouble(%f)\n", thing)
|
||||
return thing, nil
|
||||
}
|
||||
@@ -109,7 +113,7 @@ func (p *printingHandler) TestDouble(thing float64) (r float64, err error) {
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestBinary(thing []byte) (r []byte, err error) {
|
||||
func (p *printingHandler) TestBinary(ctx context.Context, thing []byte) (r []byte, err error) {
|
||||
fmt.Printf("testBinary(%s)\n", hex.EncodeToString(thing))
|
||||
return thing, nil
|
||||
}
|
||||
@@ -120,7 +124,7 @@ func (p *printingHandler) TestBinary(thing []byte) (r []byte, err error) {
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestStruct(thing *Xtruct) (r *Xtruct, err error) {
|
||||
func (p *printingHandler) TestStruct(ctx context.Context, thing *Xtruct) (r *Xtruct, err error) {
|
||||
fmt.Printf("testStruct({\"%s\", %d, %d, %d})\n", thing.StringThing, thing.ByteThing, thing.I32Thing, thing.I64Thing)
|
||||
return thing, err
|
||||
}
|
||||
@@ -131,7 +135,7 @@ func (p *printingHandler) TestStruct(thing *Xtruct) (r *Xtruct, err error) {
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestNest(nest *Xtruct2) (r *Xtruct2, err error) {
|
||||
func (p *printingHandler) TestNest(ctx context.Context, nest *Xtruct2) (r *Xtruct2, err error) {
|
||||
thing := nest.StructThing
|
||||
fmt.Printf("testNest({%d, {\"%s\", %d, %d, %d}, %d})\n", nest.ByteThing, thing.StringThing, thing.ByteThing, thing.I32Thing, thing.I64Thing, nest.I32Thing)
|
||||
return nest, nil
|
||||
@@ -144,7 +148,7 @@ func (p *printingHandler) TestNest(nest *Xtruct2) (r *Xtruct2, err error) {
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestMap(thing map[int32]int32) (r map[int32]int32, err error) {
|
||||
func (p *printingHandler) TestMap(ctx context.Context, thing map[int32]int32) (r map[int32]int32, err error) {
|
||||
fmt.Printf("testMap({")
|
||||
first := true
|
||||
for k, v := range thing {
|
||||
@@ -166,7 +170,7 @@ func (p *printingHandler) TestMap(thing map[int32]int32) (r map[int32]int32, err
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestStringMap(thing map[string]string) (r map[string]string, err error) {
|
||||
func (p *printingHandler) TestStringMap(ctx context.Context, thing map[string]string) (r map[string]string, err error) {
|
||||
fmt.Printf("testStringMap({")
|
||||
first := true
|
||||
for k, v := range thing {
|
||||
@@ -188,7 +192,7 @@ func (p *printingHandler) TestStringMap(thing map[string]string) (r map[string]s
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestSet(thing []int32) (r []int32, err error) {
|
||||
func (p *printingHandler) TestSet(ctx context.Context, thing []int32) (r []int32, err error) {
|
||||
fmt.Printf("testSet({")
|
||||
first := true
|
||||
for k, _ := range thing {
|
||||
@@ -210,7 +214,7 @@ func (p *printingHandler) TestSet(thing []int32) (r []int32, err error) {
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestList(thing []int32) (r []int32, err error) {
|
||||
func (p *printingHandler) TestList(ctx context.Context, thing []int32) (r []int32, err error) {
|
||||
fmt.Printf("testList({")
|
||||
for i, v := range thing {
|
||||
if i != 0 {
|
||||
@@ -228,7 +232,7 @@ func (p *printingHandler) TestList(thing []int32) (r []int32, err error) {
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestEnum(thing Numberz) (r Numberz, err error) {
|
||||
func (p *printingHandler) TestEnum(ctx context.Context, thing Numberz) (r Numberz, err error) {
|
||||
fmt.Printf("testEnum(%d)\n", thing)
|
||||
return thing, nil
|
||||
}
|
||||
@@ -239,7 +243,7 @@ func (p *printingHandler) TestEnum(thing Numberz) (r Numberz, err error) {
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestTypedef(thing UserId) (r UserId, err error) {
|
||||
func (p *printingHandler) TestTypedef(ctx context.Context, thing UserId) (r UserId, err error) {
|
||||
fmt.Printf("testTypedef(%d)\n", thing)
|
||||
return thing, nil
|
||||
}
|
||||
@@ -251,7 +255,7 @@ func (p *printingHandler) TestTypedef(thing UserId) (r UserId, err error) {
|
||||
//
|
||||
// Parameters:
|
||||
// - Hello
|
||||
func (p *printingHandler) TestMapMap(hello int32) (r map[int32]map[int32]int32, err error) {
|
||||
func (p *printingHandler) TestMapMap(ctx context.Context, hello int32) (r map[int32]map[int32]int32, err error) {
|
||||
fmt.Printf("testMapMap(%d)\n", hello)
|
||||
|
||||
r = map[int32]map[int32]int32{
|
||||
@@ -273,7 +277,7 @@ func (p *printingHandler) TestMapMap(hello int32) (r map[int32]map[int32]int32,
|
||||
//
|
||||
// Parameters:
|
||||
// - Argument
|
||||
func (p *printingHandler) TestInsanity(argument *Insanity) (r map[UserId]map[Numberz]*Insanity, err error) {
|
||||
func (p *printingHandler) TestInsanity(ctx context.Context, argument *Insanity) (r map[UserId]map[Numberz]*Insanity, err error) {
|
||||
fmt.Printf("testInsanity()\n")
|
||||
r = make(map[UserId]map[Numberz]*Insanity)
|
||||
r[1] = map[Numberz]*Insanity {
|
||||
@@ -303,7 +307,7 @@ func (p *printingHandler) TestInsanity(argument *Insanity) (r map[UserId]map[Num
|
||||
// - Arg3
|
||||
// - Arg4
|
||||
// - Arg5
|
||||
func (p *printingHandler) TestMulti(arg0 int8, arg1 int32, arg2 int64, arg3 map[int16]string, arg4 Numberz, arg5 UserId) (r *Xtruct, err error) {
|
||||
func (p *printingHandler) TestMulti(ctx context.Context, arg0 int8, arg1 int32, arg2 int64, arg3 map[int16]string, arg4 Numberz, arg5 UserId) (r *Xtruct, err error) {
|
||||
fmt.Printf("testMulti()\n")
|
||||
r = NewXtruct()
|
||||
|
||||
@@ -322,7 +326,7 @@ func (p *printingHandler) TestMulti(arg0 int8, arg1 int32, arg2 int64, arg3 map[
|
||||
//
|
||||
// Parameters:
|
||||
// - Arg
|
||||
func (p *printingHandler) TestException(arg string) (err error) {
|
||||
func (p *printingHandler) TestException(ctx context.Context, arg string) (err error) {
|
||||
fmt.Printf("testException(%s)\n", arg)
|
||||
switch arg {
|
||||
case "Xception":
|
||||
@@ -346,7 +350,7 @@ func (p *printingHandler) TestException(arg string) (err error) {
|
||||
// Parameters:
|
||||
// - Arg0
|
||||
// - Arg1
|
||||
func (p *printingHandler) TestMultiException(arg0 string, arg1 string) (r *Xtruct, err error) {
|
||||
func (p *printingHandler) TestMultiException(ctx context.Context, arg0 string, arg1 string) (r *Xtruct, err error) {
|
||||
fmt.Printf("testMultiException(%s, %s)\n", arg0, arg1)
|
||||
switch arg0 {
|
||||
|
||||
@@ -375,7 +379,7 @@ func (p *printingHandler) TestMultiException(arg0 string, arg1 string) (r *Xtruc
|
||||
//
|
||||
// Parameters:
|
||||
// - SecondsToSleep
|
||||
func (p *printingHandler) TestOneway(secondsToSleep int32) (err error) {
|
||||
func (p *printingHandler) TestOneway(ctx context.Context, secondsToSleep int32) (err error) {
|
||||
fmt.Printf("testOneway(%d): Sleeping...\n", secondsToSleep)
|
||||
time.Sleep(time.Second * time.Duration(secondsToSleep))
|
||||
fmt.Printf("testOneway(%d): done sleeping!\n", secondsToSleep)
|
||||
|
||||
386
vendor/github.com/apache/thrift/test/go/src/common/printing_handler_go17.go
generated
vendored
Normal file
386
vendor/github.com/apache/thrift/test/go/src/common/printing_handler_go17.go
generated
vendored
Normal file
@@ -0,0 +1,386 @@
|
||||
// +build go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package common
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"encoding/hex"
|
||||
. "gen/thrifttest"
|
||||
"time"
|
||||
)
|
||||
|
||||
var PrintingHandler = &printingHandler{}
|
||||
|
||||
type printingHandler struct{}
|
||||
|
||||
// Prints "testVoid()" and returns nothing.
|
||||
func (p *printingHandler) TestVoid(ctx context.Context) (err error) {
|
||||
fmt.Println("testVoid()")
|
||||
return nil
|
||||
}
|
||||
|
||||
// Prints 'testString("%s")' with thing as '%s'
|
||||
// @param string thing - the string to print
|
||||
// @return string - returns the string 'thing'
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestString(ctx context.Context, thing string) (r string, err error) {
|
||||
fmt.Printf("testString(\"%s\")\n", thing)
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
// Prints 'testBool("%t")' with thing as 'true' or 'false'
|
||||
// @param bool thing - the bool to print
|
||||
// @return bool - returns the bool 'thing'
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestBool(ctx context.Context, thing bool) (r bool, err error) {
|
||||
fmt.Printf("testBool(%t)\n", thing)
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
// Prints 'testByte("%d")' with thing as '%d'
|
||||
// @param byte thing - the byte to print
|
||||
// @return byte - returns the byte 'thing'
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestByte(ctx context.Context, thing int8) (r int8, err error) {
|
||||
fmt.Printf("testByte(%d)\n", thing)
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
// Prints 'testI32("%d")' with thing as '%d'
|
||||
// @param i32 thing - the i32 to print
|
||||
// @return i32 - returns the i32 'thing'
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestI32(ctx context.Context, thing int32) (r int32, err error) {
|
||||
fmt.Printf("testI32(%d)\n", thing)
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
// Prints 'testI64("%d")' with thing as '%d'
|
||||
// @param i64 thing - the i64 to print
|
||||
// @return i64 - returns the i64 'thing'
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestI64(ctx context.Context, thing int64) (r int64, err error) {
|
||||
fmt.Printf("testI64(%d)\n", thing)
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
// Prints 'testDouble("%f")' with thing as '%f'
|
||||
// @param double thing - the double to print
|
||||
// @return double - returns the double 'thing'
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestDouble(ctx context.Context, thing float64) (r float64, err error) {
|
||||
fmt.Printf("testDouble(%f)\n", thing)
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
// Prints 'testBinary("%s")' where '%s' is a hex-formatted string of thing's data
|
||||
// @param []byte thing - the binary to print
|
||||
// @return []byte - returns the binary 'thing'
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestBinary(ctx context.Context, thing []byte) (r []byte, err error) {
|
||||
fmt.Printf("testBinary(%s)\n", hex.EncodeToString(thing))
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
// Prints 'testStruct("{%s}")' where thing has been formatted into a string of comma separated values
|
||||
// @param Xtruct thing - the Xtruct to print
|
||||
// @return Xtruct - returns the Xtruct 'thing'
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestStruct(ctx context.Context, thing *Xtruct) (r *Xtruct, err error) {
|
||||
fmt.Printf("testStruct({\"%s\", %d, %d, %d})\n", thing.StringThing, thing.ByteThing, thing.I32Thing, thing.I64Thing)
|
||||
return thing, err
|
||||
}
|
||||
|
||||
// Prints 'testNest("{%s}")' where thing has been formatted into a string of the nested struct
|
||||
// @param Xtruct2 thing - the Xtruct2 to print
|
||||
// @return Xtruct2 - returns the Xtruct2 'thing'
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestNest(ctx context.Context, nest *Xtruct2) (r *Xtruct2, err error) {
|
||||
thing := nest.StructThing
|
||||
fmt.Printf("testNest({%d, {\"%s\", %d, %d, %d}, %d})\n", nest.ByteThing, thing.StringThing, thing.ByteThing, thing.I32Thing, thing.I64Thing, nest.I32Thing)
|
||||
return nest, nil
|
||||
}
|
||||
|
||||
// Prints 'testMap("{%s")' where thing has been formatted into a string of 'key => value' pairs
|
||||
// separated by commas and new lines
|
||||
// @param map<i32,i32> thing - the map<i32,i32> to print
|
||||
// @return map<i32,i32> - returns the map<i32,i32> 'thing'
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestMap(ctx context.Context, thing map[int32]int32) (r map[int32]int32, err error) {
|
||||
fmt.Printf("testMap({")
|
||||
first := true
|
||||
for k, v := range thing {
|
||||
if first {
|
||||
first = false
|
||||
} else {
|
||||
fmt.Printf(", ")
|
||||
}
|
||||
fmt.Printf("%d => %d", k, v)
|
||||
}
|
||||
fmt.Printf("})\n")
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
// Prints 'testStringMap("{%s}")' where thing has been formatted into a string of 'key => value' pairs
|
||||
// separated by commas and new lines
|
||||
// @param map<string,string> thing - the map<string,string> to print
|
||||
// @return map<string,string> - returns the map<string,string> 'thing'
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestStringMap(ctx context.Context, thing map[string]string) (r map[string]string, err error) {
|
||||
fmt.Printf("testStringMap({")
|
||||
first := true
|
||||
for k, v := range thing {
|
||||
if first {
|
||||
first = false
|
||||
} else {
|
||||
fmt.Printf(", ")
|
||||
}
|
||||
fmt.Printf("%s => %s", k, v)
|
||||
}
|
||||
fmt.Printf("})\n")
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
// Prints 'testSet("{%s}")' where thing has been formatted into a string of values
|
||||
// separated by commas and new lines
|
||||
// @param set<i32> thing - the set<i32> to print
|
||||
// @return set<i32> - returns the set<i32> 'thing'
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestSet(ctx context.Context, thing []int32) (r []int32, err error) {
|
||||
fmt.Printf("testSet({")
|
||||
first := true
|
||||
for k, _ := range thing {
|
||||
if first {
|
||||
first = false
|
||||
} else {
|
||||
fmt.Printf(", ")
|
||||
}
|
||||
fmt.Printf("%d", k)
|
||||
}
|
||||
fmt.Printf("})\n")
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
// Prints 'testList("{%s}")' where thing has been formatted into a string of values
|
||||
// separated by commas and new lines
|
||||
// @param list<i32> thing - the list<i32> to print
|
||||
// @return list<i32> - returns the list<i32> 'thing'
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestList(ctx context.Context, thing []int32) (r []int32, err error) {
|
||||
fmt.Printf("testList({")
|
||||
for i, v := range thing {
|
||||
if i != 0 {
|
||||
fmt.Printf(", ")
|
||||
}
|
||||
fmt.Printf("%d", v)
|
||||
}
|
||||
fmt.Printf("})\n")
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
// Prints 'testEnum("%d")' where thing has been formatted into it's numeric value
|
||||
// @param Numberz thing - the Numberz to print
|
||||
// @return Numberz - returns the Numberz 'thing'
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestEnum(ctx context.Context, thing Numberz) (r Numberz, err error) {
|
||||
fmt.Printf("testEnum(%d)\n", thing)
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
// Prints 'testTypedef("%d")' with thing as '%d'
|
||||
// @param UserId thing - the UserId to print
|
||||
// @return UserId - returns the UserId 'thing'
|
||||
//
|
||||
// Parameters:
|
||||
// - Thing
|
||||
func (p *printingHandler) TestTypedef(ctx context.Context, thing UserId) (r UserId, err error) {
|
||||
fmt.Printf("testTypedef(%d)\n", thing)
|
||||
return thing, nil
|
||||
}
|
||||
|
||||
// Prints 'testMapMap("%d")' with hello as '%d'
|
||||
// @param i32 hello - the i32 to print
|
||||
// @return map<i32,map<i32,i32>> - returns a dictionary with these values:
|
||||
// {-4 => {-4 => -4, -3 => -3, -2 => -2, -1 => -1, }, 4 => {1 => 1, 2 => 2, 3 => 3, 4 => 4, }, }
|
||||
//
|
||||
// Parameters:
|
||||
// - Hello
|
||||
func (p *printingHandler) TestMapMap(ctx context.Context, hello int32) (r map[int32]map[int32]int32, err error) {
|
||||
fmt.Printf("testMapMap(%d)\n", hello)
|
||||
|
||||
r = map[int32]map[int32]int32{
|
||||
-4: map[int32]int32{-4: -4, -3: -3, -2: -2, -1: -1},
|
||||
4: map[int32]int32{4: 4, 3: 3, 2: 2, 1: 1},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// So you think you've got this all worked, out eh?
|
||||
//
|
||||
// Creates a the returned map with these values and prints it out:
|
||||
// { 1 => { 2 => argument,
|
||||
// 3 => argument,
|
||||
// },
|
||||
// 2 => { 6 => <empty Insanity struct>, },
|
||||
// }
|
||||
// @return map<UserId, map<Numberz,Insanity>> - a map with the above values
|
||||
//
|
||||
// Parameters:
|
||||
// - Argument
|
||||
func (p *printingHandler) TestInsanity(ctx context.Context, argument *Insanity) (r map[UserId]map[Numberz]*Insanity, err error) {
|
||||
fmt.Printf("testInsanity()\n")
|
||||
r = make(map[UserId]map[Numberz]*Insanity)
|
||||
r[1] = map[Numberz]*Insanity {
|
||||
2: argument,
|
||||
3: argument,
|
||||
}
|
||||
r[2] = map[Numberz]*Insanity {
|
||||
6: NewInsanity(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Prints 'testMulti()'
|
||||
// @param byte arg0 -
|
||||
// @param i32 arg1 -
|
||||
// @param i64 arg2 -
|
||||
// @param map<i16, string> arg3 -
|
||||
// @param Numberz arg4 -
|
||||
// @param UserId arg5 -
|
||||
// @return Xtruct - returns an Xtruct with StringThing = "Hello2, ByteThing = arg0, I32Thing = arg1
|
||||
// and I64Thing = arg2
|
||||
//
|
||||
// Parameters:
|
||||
// - Arg0
|
||||
// - Arg1
|
||||
// - Arg2
|
||||
// - Arg3
|
||||
// - Arg4
|
||||
// - Arg5
|
||||
func (p *printingHandler) TestMulti(ctx context.Context, arg0 int8, arg1 int32, arg2 int64, arg3 map[int16]string, arg4 Numberz, arg5 UserId) (r *Xtruct, err error) {
|
||||
fmt.Printf("testMulti()\n")
|
||||
r = NewXtruct()
|
||||
|
||||
r.StringThing = "Hello2"
|
||||
r.ByteThing = arg0
|
||||
r.I32Thing = arg1
|
||||
r.I64Thing = arg2
|
||||
return
|
||||
}
|
||||
|
||||
// Print 'testException(%s)' with arg as '%s'
|
||||
// @param string arg - a string indication what type of exception to throw
|
||||
// if arg == "Xception" throw Xception with errorCode = 1001 and message = arg
|
||||
// elsen if arg == "TException" throw TException
|
||||
// else do not throw anything
|
||||
//
|
||||
// Parameters:
|
||||
// - Arg
|
||||
func (p *printingHandler) TestException(ctx context.Context, arg string) (err error) {
|
||||
fmt.Printf("testException(%s)\n", arg)
|
||||
switch arg {
|
||||
case "Xception":
|
||||
e := NewXception()
|
||||
e.ErrorCode = 1001
|
||||
e.Message = arg
|
||||
return e
|
||||
case "TException":
|
||||
return errors.New("Just TException")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Print 'testMultiException(%s, %s)' with arg0 as '%s' and arg1 as '%s'
|
||||
// @param string arg - a string indication what type of exception to throw
|
||||
// if arg0 == "Xception" throw Xception with errorCode = 1001 and message = "This is an Xception"
|
||||
// elsen if arg0 == "Xception2" throw Xception2 with errorCode = 2002 and message = "This is an Xception2"
|
||||
// else do not throw anything
|
||||
// @return Xtruct - an Xtruct with StringThing = arg1
|
||||
//
|
||||
// Parameters:
|
||||
// - Arg0
|
||||
// - Arg1
|
||||
func (p *printingHandler) TestMultiException(ctx context.Context, arg0 string, arg1 string) (r *Xtruct, err error) {
|
||||
fmt.Printf("testMultiException(%s, %s)\n", arg0, arg1)
|
||||
switch arg0 {
|
||||
|
||||
case "Xception":
|
||||
e := NewXception()
|
||||
e.ErrorCode = 1001
|
||||
e.Message = "This is an Xception"
|
||||
return nil, e
|
||||
case "Xception2":
|
||||
e := NewXception2()
|
||||
e.ErrorCode = 2002
|
||||
e.StructThing = NewXtruct()
|
||||
e.StructThing.StringThing = "This is an Xception2"
|
||||
return nil, e
|
||||
default:
|
||||
r = NewXtruct()
|
||||
r.StringThing = arg1
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Print 'testOneway(%d): Sleeping...' with secondsToSleep as '%d'
|
||||
// sleep 'secondsToSleep'
|
||||
// Print 'testOneway(%d): done sleeping!' with secondsToSleep as '%d'
|
||||
// @param i32 secondsToSleep - the number of seconds to sleep
|
||||
//
|
||||
// Parameters:
|
||||
// - SecondsToSleep
|
||||
func (p *printingHandler) TestOneway(ctx context.Context, secondsToSleep int32) (err error) {
|
||||
fmt.Printf("testOneway(%d): Sleeping...\n", secondsToSleep)
|
||||
time.Sleep(time.Second * time.Duration(secondsToSleep))
|
||||
fmt.Printf("testOneway(%d): done sleeping!\n", secondsToSleep)
|
||||
return
|
||||
}
|
||||
21
vendor/github.com/apache/thrift/tutorial/go/Makefile.am
generated
vendored
21
vendor/github.com/apache/thrift/tutorial/go/Makefile.am
generated
vendored
@@ -17,30 +17,37 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
if GOVERSION_LT_17
|
||||
COMPILER_EXTRAFLAG=":legacy_context"
|
||||
endif
|
||||
|
||||
THRIFT = $(top_builddir)/compiler/cpp/thrift
|
||||
|
||||
gen-go/tutorial/calculator.go gen-go/shared/shared_service.go: $(top_srcdir)/tutorial/tutorial.thrift
|
||||
$(THRIFT) --gen go -r $<
|
||||
$(THRIFT) --gen go$(COMPILER_EXTRAFLAG) -r $<
|
||||
|
||||
all-local: gen-go/tutorial/calculator.go
|
||||
|
||||
|
||||
check: src/git.apache.org/thrift.git/lib/go/thrift
|
||||
$(THRIFT) -r --gen go $(top_srcdir)/tutorial/tutorial.thrift
|
||||
check: src/git.apache.org/thrift.git/lib/go/thrift thirdparty-dep
|
||||
$(THRIFT) -r --gen go$(COMPILER_EXTRAFLAG) $(top_srcdir)/tutorial/tutorial.thrift
|
||||
cp -r gen-go/* src/
|
||||
GOPATH=`pwd` $(GO) build ./...
|
||||
GOPATH=`pwd` $(GO) build -o go-tutorial src/*.go
|
||||
GOPATH=`pwd` $(GO) build -o go-tutorial ./src
|
||||
GOPATH=`pwd` $(GO) build -o calculator-remote src/tutorial/calculator-remote/calculator-remote.go
|
||||
|
||||
src/git.apache.org/thrift.git/lib/go/thrift:
|
||||
mkdir -p src/git.apache.org/thrift.git/lib/go
|
||||
ln -sf $(realpath $(top_srcdir)/lib/go/thrift) src/git.apache.org/thrift.git/lib/go/thrift
|
||||
|
||||
thirdparty-dep:
|
||||
mkdir -p src/golang.org/x/net
|
||||
GOPATH=`pwd`/gopath $(GO) get golang.org/x/net/context
|
||||
ln -sf `pwd`/gopath/src/golang.org/x/net/context src/golang.org/x/net/context
|
||||
|
||||
tutorialserver: all
|
||||
GOPATH=`pwd` $(GO) run src/*.go -server=true
|
||||
|
||||
tutorialclient: all
|
||||
GOPATH=`pwd` $(GO) run src/*.go
|
||||
GOPATH=`pwd` $(GO) run src/*.go
|
||||
|
||||
tutorialsecureserver: all
|
||||
GOPATH=`pwd` $(GO) run src/*.go -server=true -secure=true
|
||||
|
||||
10
vendor/github.com/apache/thrift/tutorial/go/src/client.go
generated
vendored
10
vendor/github.com/apache/thrift/tutorial/go/src/client.go
generated
vendored
@@ -27,17 +27,17 @@ import (
|
||||
)
|
||||
|
||||
func handleClient(client *tutorial.CalculatorClient) (err error) {
|
||||
client.Ping()
|
||||
client.Ping(defaultCtx)
|
||||
fmt.Println("ping()")
|
||||
|
||||
sum, _ := client.Add(1, 1)
|
||||
sum, _ := client.Add(defaultCtx, 1, 1)
|
||||
fmt.Print("1+1=", sum, "\n")
|
||||
|
||||
work := tutorial.NewWork()
|
||||
work.Op = tutorial.Operation_DIVIDE
|
||||
work.Num1 = 1
|
||||
work.Num2 = 0
|
||||
quotient, err := client.Calculate(1, work)
|
||||
quotient, err := client.Calculate(defaultCtx, 1, work)
|
||||
if err != nil {
|
||||
switch v := err.(type) {
|
||||
case *tutorial.InvalidOperation:
|
||||
@@ -53,7 +53,7 @@ func handleClient(client *tutorial.CalculatorClient) (err error) {
|
||||
work.Op = tutorial.Operation_SUBTRACT
|
||||
work.Num1 = 15
|
||||
work.Num2 = 10
|
||||
diff, err := client.Calculate(1, work)
|
||||
diff, err := client.Calculate(defaultCtx, 1, work)
|
||||
if err != nil {
|
||||
switch v := err.(type) {
|
||||
case *tutorial.InvalidOperation:
|
||||
@@ -66,7 +66,7 @@ func handleClient(client *tutorial.CalculatorClient) (err error) {
|
||||
fmt.Print("15-10=", diff, "\n")
|
||||
}
|
||||
|
||||
log, err := client.GetStruct(1)
|
||||
log, err := client.GetStruct(defaultCtx, 1)
|
||||
if err != nil {
|
||||
fmt.Println("Unable to get struct:", err)
|
||||
return err
|
||||
|
||||
26
vendor/github.com/apache/thrift/tutorial/go/src/go17.go
generated
vendored
Normal file
26
vendor/github.com/apache/thrift/tutorial/go/src/go17.go
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
// +build go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import "context"
|
||||
|
||||
var defaultCtx = context.Background()
|
||||
14
vendor/github.com/apache/thrift/tutorial/go/src/handler.go
generated
vendored
14
vendor/github.com/apache/thrift/tutorial/go/src/handler.go
generated
vendored
@@ -1,3 +1,5 @@
|
||||
// +build !go1.7
|
||||
|
||||
package main
|
||||
|
||||
/*
|
||||
@@ -24,6 +26,8 @@ import (
|
||||
"shared"
|
||||
"strconv"
|
||||
"tutorial"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
type CalculatorHandler struct {
|
||||
@@ -34,17 +38,17 @@ func NewCalculatorHandler() *CalculatorHandler {
|
||||
return &CalculatorHandler{log: make(map[int]*shared.SharedStruct)}
|
||||
}
|
||||
|
||||
func (p *CalculatorHandler) Ping() (err error) {
|
||||
func (p *CalculatorHandler) Ping(ctx context.Context) (err error) {
|
||||
fmt.Print("ping()\n")
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *CalculatorHandler) Add(num1 int32, num2 int32) (retval17 int32, err error) {
|
||||
func (p *CalculatorHandler) Add(ctx context.Context, num1 int32, num2 int32) (retval17 int32, err error) {
|
||||
fmt.Print("add(", num1, ",", num2, ")\n")
|
||||
return num1 + num2, nil
|
||||
}
|
||||
|
||||
func (p *CalculatorHandler) Calculate(logid int32, w *tutorial.Work) (val int32, err error) {
|
||||
func (p *CalculatorHandler) Calculate(ctx context.Context, logid int32, w *tutorial.Work) (val int32, err error) {
|
||||
fmt.Print("calculate(", logid, ", {", w.Op, ",", w.Num1, ",", w.Num2, "})\n")
|
||||
switch w.Op {
|
||||
case tutorial.Operation_ADD:
|
||||
@@ -89,13 +93,13 @@ func (p *CalculatorHandler) Calculate(logid int32, w *tutorial.Work) (val int32,
|
||||
return val, err
|
||||
}
|
||||
|
||||
func (p *CalculatorHandler) GetStruct(key int32) (*shared.SharedStruct, error) {
|
||||
func (p *CalculatorHandler) GetStruct(ctx context.Context, key int32) (*shared.SharedStruct, error) {
|
||||
fmt.Print("getStruct(", key, ")\n")
|
||||
v, _ := p.log[int(key)]
|
||||
return v, nil
|
||||
}
|
||||
|
||||
func (p *CalculatorHandler) Zip() (err error) {
|
||||
func (p *CalculatorHandler) Zip(ctx context.Context) (err error) {
|
||||
fmt.Print("zip()\n")
|
||||
return nil
|
||||
}
|
||||
|
||||
104
vendor/github.com/apache/thrift/tutorial/go/src/handler_go17.go
generated
vendored
Normal file
104
vendor/github.com/apache/thrift/tutorial/go/src/handler_go17.go
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
// +build go1.7
|
||||
|
||||
package main
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"shared"
|
||||
"strconv"
|
||||
"tutorial"
|
||||
)
|
||||
|
||||
type CalculatorHandler struct {
|
||||
log map[int]*shared.SharedStruct
|
||||
}
|
||||
|
||||
func NewCalculatorHandler() *CalculatorHandler {
|
||||
return &CalculatorHandler{log: make(map[int]*shared.SharedStruct)}
|
||||
}
|
||||
|
||||
func (p *CalculatorHandler) Ping(ctx context.Context) (err error) {
|
||||
fmt.Print("ping()\n")
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *CalculatorHandler) Add(ctx context.Context, num1 int32, num2 int32) (retval17 int32, err error) {
|
||||
fmt.Print("add(", num1, ",", num2, ")\n")
|
||||
return num1 + num2, nil
|
||||
}
|
||||
|
||||
func (p *CalculatorHandler) Calculate(ctx context.Context, logid int32, w *tutorial.Work) (val int32, err error) {
|
||||
fmt.Print("calculate(", logid, ", {", w.Op, ",", w.Num1, ",", w.Num2, "})\n")
|
||||
switch w.Op {
|
||||
case tutorial.Operation_ADD:
|
||||
val = w.Num1 + w.Num2
|
||||
break
|
||||
case tutorial.Operation_SUBTRACT:
|
||||
val = w.Num1 - w.Num2
|
||||
break
|
||||
case tutorial.Operation_MULTIPLY:
|
||||
val = w.Num1 * w.Num2
|
||||
break
|
||||
case tutorial.Operation_DIVIDE:
|
||||
if w.Num2 == 0 {
|
||||
ouch := tutorial.NewInvalidOperation()
|
||||
ouch.WhatOp = int32(w.Op)
|
||||
ouch.Why = "Cannot divide by 0"
|
||||
err = ouch
|
||||
return
|
||||
}
|
||||
val = w.Num1 / w.Num2
|
||||
break
|
||||
default:
|
||||
ouch := tutorial.NewInvalidOperation()
|
||||
ouch.WhatOp = int32(w.Op)
|
||||
ouch.Why = "Unknown operation"
|
||||
err = ouch
|
||||
return
|
||||
}
|
||||
entry := shared.NewSharedStruct()
|
||||
entry.Key = logid
|
||||
entry.Value = strconv.Itoa(int(val))
|
||||
k := int(logid)
|
||||
/*
|
||||
oldvalue, exists := p.log[k]
|
||||
if exists {
|
||||
fmt.Print("Replacing ", oldvalue, " with ", entry, " for key ", k, "\n")
|
||||
} else {
|
||||
fmt.Print("Adding ", entry, " for key ", k, "\n")
|
||||
}
|
||||
*/
|
||||
p.log[k] = entry
|
||||
return val, err
|
||||
}
|
||||
|
||||
func (p *CalculatorHandler) GetStruct(ctx context.Context, key int32) (*shared.SharedStruct, error) {
|
||||
fmt.Print("getStruct(", key, ")\n")
|
||||
v, _ := p.log[int(key)]
|
||||
return v, nil
|
||||
}
|
||||
|
||||
func (p *CalculatorHandler) Zip(ctx context.Context) (err error) {
|
||||
fmt.Print("zip()\n")
|
||||
return nil
|
||||
}
|
||||
26
vendor/github.com/apache/thrift/tutorial/go/src/pre_go17.go
generated
vendored
Normal file
26
vendor/github.com/apache/thrift/tutorial/go/src/pre_go17.go
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
// +build !go1.7
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import "golang.org/x/net/context"
|
||||
|
||||
var defaultCtx = context.Background()
|
||||
Reference in New Issue
Block a user