Skip to content

Commit 99ab4e8

Browse files
committed
libmemcached: add MEMCACHED_BEHAVIOR_META_PROTOCOL
1 parent a29ba11 commit 99ab4e8

32 files changed

+788
-274
lines changed

ChangeLog-1.1.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@ the full list of changes since the last 1.0 release.
6767

6868
> released 2020-12-21
6969
70-
**NOTE:**
71-
This is a bug fix release, not a feature release. The minor version number
72-
was incremented due to the following changes:
73-
7470
* Ported build system to CMake.
7571
* Ported test suite to Catch2.
7672
* Build requires C++11 compiler support.

ChangeLog-1.2.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# ChangeLog v1.2
2+
3+
## v 1.2.0-beta1
4+
5+
> released TBD
6+
7+
* Initial transparent support for the memcached META protocol:
8+
* Add `MEMCACHED_BEHAVIOR_META_PROTOCOL` enabling the META protocol.
9+
* Add `-m` switch to client programs enabling the META protocol.

ChangeLog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ChangeLog-1.1.md
1+
ChangeLog-1.2.md

docs/source/ChangeLog-1.1.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,6 @@ v 1.1.0-beta1
9696
released 2020-12-21
9797

9898

99-
**NOTE:**\ :raw-html-m2r:`<br>`
100-
This is a bug fix release, not a feature release. The minor version number
101-
was incremented due to the following changes:
102-
10399

104100
* Ported build system to CMake.
105101
* Ported test suite to Catch2.

docs/source/ChangeLog-1.2.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
ChangeLog v1.2
3+
==============
4+
5+
v 1.2.0-beta1
6+
-------------
7+
8+
..
9+
10+
released TBD
11+
12+
13+
14+
* Initial transparent support for the memcached META protocol:
15+
16+
* Add ``MEMCACHED_BEHAVIOR_META_PROTOCOL`` enabling the META protocol.
17+
* Add ``-m`` switch to client programs enabling the META protocol.

docs/source/changelogs.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ Change Logs
33

44
.. toctree::
55

6-
ChangeLog-1.1
6+
ChangeLog-1.2
77

88
.. toctree::
99
:maxdepth: 1
1010

11+
ChangeLog-1.1
1112
ChangeLog-1.0
1213
ChangeLog-0

docs/source/libmemcached/memcached_behavior.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,12 @@ SYNOPSIS
179179
Enable the use of the binary protocol. Please note that you cannot
180180
toggle this flag on an open connection.
181181

182+
.. enumerator:: MEMCACHED_BEHAVIOR_META_PROTOCOL
183+
184+
Enable the use of the META protocol. This setting can be switched on and
185+
off at will when using an ASCII protocol connection, but causes
186+
a reconnect when using the binary protocol.
187+
182188
.. enumerator:: MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK
183189

184190
Set this value to tune the number of messages that may be sent before

include/libmemcached-1.0/struct/memcached.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct memcached_st {
4343
bool tcp_keepalive : 1;
4444
bool is_aes : 1;
4545
bool is_fetching_version : 1;
46-
bool not_used : 1;
46+
bool meta_protocol : 1;
4747
} flags;
4848

4949
memcached_server_distribution_t distribution;

include/libmemcached-1.0/types/behavior.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ enum memcached_behavior_t {
5454
MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS,
5555
MEMCACHED_BEHAVIOR_DEAD_TIMEOUT,
5656
MEMCACHED_BEHAVIOR_SERVER_TIMEOUT_LIMIT,
57+
MEMCACHED_BEHAVIOR_META_PROTOCOL,
5758
MEMCACHED_BEHAVIOR_MAX
5859
};
5960

src/bin/common/options.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,17 @@ class client_options {
125125
}
126126
return true;
127127
};
128+
def("meta", 'm', no_argument, "Use the text based meta memcached protocol.")
129+
.apply = [](const client_options &opt_, const extended_option &ext, memcached_st *memc) {
130+
if (MEMCACHED_SUCCESS != memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_META_PROTOCOL, ext.set)) {
131+
if (!opt_.isset("quiet")) {
132+
std::cerr << memcached_last_error_message(memc);
133+
}
134+
return false;
135+
}
136+
return true;
137+
};
138+
128139
def("buffer", 'B', no_argument, "Buffer requests.")
129140
.apply = [](const client_options &opt, const extended_option &ext, memcached_st *memc) {
130141
if (MEMCACHED_SUCCESS != memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, ext.set)) {

0 commit comments

Comments
 (0)