2014-11-21 10:51:34 +00:00
|
|
|
/*
|
|
|
|
* MARS Long Distance Replication Software
|
|
|
|
*
|
|
|
|
* This file is part of MARS project: http://schoebel.github.io/mars/
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010-2014 Thomas Schoebel-Theuer
|
|
|
|
* Copyright (C) 2011-2014 1&1 Internet AG
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2011-02-23 20:48:06 +00:00
|
|
|
#ifndef MARS_CLIENT_H
|
|
|
|
#define MARS_CLIENT_H
|
|
|
|
|
|
|
|
#include "mars_net.h"
|
2012-08-07 12:07:12 +00:00
|
|
|
#include "lib_limiter.h"
|
|
|
|
|
2020-10-01 21:14:29 +00:00
|
|
|
#ifdef CONFIG_MARS_DEBUG
|
|
|
|
#define MARS_CLIENT_DEBUGGING
|
|
|
|
#endif
|
|
|
|
|
2012-08-07 12:07:12 +00:00
|
|
|
extern struct mars_limiter client_limiter;
|
2012-08-14 14:12:59 +00:00
|
|
|
extern int global_net_io_timeout;
|
2020-01-27 06:21:10 +00:00
|
|
|
extern int mars_client_info_timeout;
|
2014-01-21 07:25:35 +00:00
|
|
|
extern int mars_client_abort;
|
2014-04-01 09:24:46 +00:00
|
|
|
extern int max_client_channels;
|
|
|
|
extern int max_client_bulk;
|
|
|
|
|
|
|
|
#define MAX_CLIENT_CHANNELS 4
|
2011-02-23 20:48:06 +00:00
|
|
|
|
|
|
|
struct client_mref_aspect {
|
|
|
|
GENERIC_ASPECT(mref);
|
|
|
|
struct list_head io_head;
|
2011-03-30 12:02:50 +00:00
|
|
|
struct list_head hash_head;
|
2012-12-19 11:40:52 +00:00
|
|
|
struct list_head tmp_head;
|
2017-07-06 06:06:38 +00:00
|
|
|
struct lamport_time submit_stamp;
|
2011-11-14 17:52:05 +00:00
|
|
|
int alloc_len;
|
2011-02-23 20:48:06 +00:00
|
|
|
bool do_dealloc;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct client_brick {
|
|
|
|
MARS_BRICK(client);
|
2011-03-29 14:40:40 +00:00
|
|
|
// tunables
|
|
|
|
int max_flying; // limit on parallelism
|
2016-02-02 08:37:39 +00:00
|
|
|
bool keep_idle_sockets;
|
2012-08-07 12:07:12 +00:00
|
|
|
bool limit_mode;
|
2014-04-01 09:24:46 +00:00
|
|
|
bool allow_permuting_writes;
|
|
|
|
bool separate_reads;
|
2013-04-11 12:58:36 +00:00
|
|
|
// readonly from outside
|
2016-01-27 11:32:55 +00:00
|
|
|
int connection_state; // 0 = switched off, 1 = connected
|
2020-09-03 08:45:04 +00:00
|
|
|
int connection_error;
|
|
|
|
int protocol_error;
|
2020-01-22 13:19:14 +00:00
|
|
|
atomic_t sender_count;
|
|
|
|
atomic_t receiver_count;
|
2016-01-25 06:11:14 +00:00
|
|
|
int socket_count;
|
2016-01-25 06:22:42 +00:00
|
|
|
atomic_t fly_count;
|
2020-10-01 21:14:29 +00:00
|
|
|
#ifdef MARS_CLIENT_DEBUGGING
|
|
|
|
atomic_t infinite_count;
|
|
|
|
atomic_t skip_count;
|
|
|
|
atomic_t check_count;
|
2016-01-25 06:22:42 +00:00
|
|
|
atomic_t timeout_count;
|
2020-10-01 21:14:29 +00:00
|
|
|
#endif
|
2017-07-06 06:06:38 +00:00
|
|
|
struct lamport_time hang_stamp; /* submit stamp of eldest request */
|
2016-01-27 11:32:55 +00:00
|
|
|
struct lamport_time last_timeout_stamp;
|
2011-02-23 20:48:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct client_input {
|
|
|
|
MARS_INPUT(client);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct client_threadinfo {
|
|
|
|
struct task_struct *thread;
|
2014-04-01 09:24:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct client_channel {
|
|
|
|
struct mars_socket socket;
|
|
|
|
struct client_threadinfo receiver;
|
|
|
|
struct list_head wait_list;
|
|
|
|
struct client_output *output;
|
|
|
|
long current_space;
|
|
|
|
int thread_count;
|
|
|
|
int recv_error;
|
|
|
|
int ch_nr;
|
|
|
|
bool is_used;
|
|
|
|
bool is_open;
|
|
|
|
bool is_connected;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct client_bundle {
|
|
|
|
char *host;
|
|
|
|
char *path;
|
2018-05-10 09:16:34 +00:00
|
|
|
struct mars_tcp_params *params;
|
2014-04-01 09:24:46 +00:00
|
|
|
int thread_count;
|
2015-06-15 05:48:54 +00:00
|
|
|
int old_channel;
|
2014-04-01 09:24:46 +00:00
|
|
|
wait_queue_head_t sender_event;
|
|
|
|
struct client_threadinfo sender;
|
|
|
|
struct client_channel channel[MAX_CLIENT_CHANNELS];
|
2011-02-23 20:48:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct client_output {
|
|
|
|
MARS_OUTPUT(client);
|
2017-12-10 21:23:48 +00:00
|
|
|
struct mutex mutex;
|
2011-02-23 20:48:06 +00:00
|
|
|
struct list_head mref_list;
|
2014-04-01 09:24:46 +00:00
|
|
|
struct client_bundle bundle;
|
2011-02-23 20:48:06 +00:00
|
|
|
struct mars_info info;
|
2020-09-07 11:48:28 +00:00
|
|
|
struct lamport_time stor_epoch;
|
2020-09-22 09:39:27 +00:00
|
|
|
struct lamport_time *prosumer_epoch;
|
2020-09-09 11:58:27 +00:00
|
|
|
int last_id;
|
2020-09-07 11:48:28 +00:00
|
|
|
bool fatal_error;
|
2011-03-07 05:55:10 +00:00
|
|
|
bool get_info;
|
2011-02-23 20:48:06 +00:00
|
|
|
bool got_info;
|
2013-04-12 12:13:21 +00:00
|
|
|
struct list_head *hash_table;
|
2011-02-23 20:48:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
MARS_TYPES(client);
|
|
|
|
|
|
|
|
#endif
|