blob: 78ddefe6e7149c6d8b4d64440ce5eed86188ad2f [file] [log] [blame]
David Reissea2cba82009-03-30 21:35:00 +00001%%
2%% Licensed to the Apache Software Foundation (ASF) under one
3%% or more contributor license agreements. See the NOTICE file
4%% distributed with this work for additional information
5%% regarding copyright ownership. The ASF licenses this file
6%% to you under the Apache License, Version 2.0 (the
7%% "License"); you may not use this file except in compliance
8%% with the License. You may obtain a copy of the License at
9%%
10%% http://www.apache.org/licenses/LICENSE-2.0
11%%
12%% Unless required by applicable law or agreed to in writing,
13%% software distributed under the License is distributed on an
14%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15%% KIND, either express or implied. See the License for the
16%% specific language governing permissions and limitations
17%% under the License.
18%%
19
David Reiss60b50cf2008-06-10 22:59:10 +000020-module(stress_server).
21
Sergei Elin45764092022-09-23 23:21:31 +030022-export([
23 start_link/1,
David Reiss60b50cf2008-06-10 22:59:10 +000024
Sergei Elin45764092022-09-23 23:21:31 +030025 handle_function/2,
David Reiss60b50cf2008-06-10 22:59:10 +000026
Sergei Elin45764092022-09-23 23:21:31 +030027 echoVoid/0,
28 echoByte/1,
29 echoI32/1,
30 echoI64/1,
31 echoString/1,
32 echoList/1,
33 echoSet/1,
34 echoMap/1
35]).
David Reiss60b50cf2008-06-10 22:59:10 +000036
37start_link(Port) ->
38 thrift_server:start_link(Port, service_thrift, ?MODULE).
39
David Reiss60b50cf2008-06-10 22:59:10 +000040handle_function(Function, Args) ->
41 case apply(?MODULE, Function, tuple_to_list(Args)) of
42 ok ->
Sergei Elin45764092022-09-23 23:21:31 +030043 ok;
44 Else ->
45 {reply, Else}
David Reiss60b50cf2008-06-10 22:59:10 +000046 end.
47
David Reiss60b50cf2008-06-10 22:59:10 +000048echoVoid() ->
49 ok.
50echoByte(X) ->
51 X.
52echoI32(X) ->
53 X.
54echoI64(X) ->
55 X.
56echoString(X) ->
57 X.
58echoList(X) ->
59 X.
60echoSet(X) ->
61 X.
62echoMap(X) ->
63 X.