1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
#ifndef TARANTOOL_IPROTO_H_INCLUDED
#define TARANTOOL_IPROTO_H_INCLUDED
/*
* Copyright 2010-2016, Tarantool AUTHORS, please see AUTHORS file.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* <COPYRIGHT HOLDER> OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <stddef.h>
#if defined(__cplusplus)
extern "C" {
#endif /* defined(__cplusplus) */
enum {
/** The minimal value for net_msg_max. */
IPROTO_MSG_MAX_MIN = 2,
/**
* The size of tx fiber pool for iproto requests is
* limited by the number of concurrent iproto messages,
* with the ratio defined in this constant.
* The ratio is not 1:1 because of long-polling requests.
* Ideally we should not account long polling requests in
* the ratio, but currently we can not separate them from
* short-living requests, all requests are handled by the
* same pool. When the pool size is exhausted, message
* processing stops until some new fibers are freed up.
*/
IPROTO_FIBER_POOL_SIZE_FACTOR = 5,
};
extern unsigned iproto_readahead;
/**
* Return size of memory used for storing network buffers.
*/
size_t
iproto_mem_used(void);
/**
* Return the number of active iproto connections.
*/
size_t
iproto_connection_count(void);
/**
* Return the number of iproto requests in flight.
*/
size_t
iproto_request_count(void);
/**
* Reset network statistics.
*/
void
iproto_reset_stat(void);
/**
* String representation of the address served by
* iproto. To be shown in box.info.
*/
const char *
iproto_bound_address(void);
#if defined(__cplusplus)
} /* extern "C" */
void
iproto_init(void);
void
iproto_listen(const char *uri);
void
iproto_set_msg_max(int iproto_msg_max);
void
iproto_free(void);
#endif /* defined(__cplusplus) */
#endif
|