Skip to content

Commit 5a6a6ab

Browse files
committed
libmemcached: add MEMCACHED_BEHAVIOR_META_PROTOCOL
1 parent bcc1a6e commit 5a6a6ab

31 files changed

+788
-270
lines changed

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
@@ -126,6 +126,17 @@ class client_options {
126126
}
127127
return true;
128128
};
129+
def("meta", 'm', no_argument, "Use the text based meta memcached protocol.")
130+
.apply = [](const client_options &opt_, const extended_option &ext, memcached_st *memc) {
131+
if (MEMCACHED_SUCCESS != memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_META_PROTOCOL, ext.set)) {
132+
if (!opt_.isset("quiet")) {
133+
std::cerr << memcached_last_error_message(memc);
134+
}
135+
return false;
136+
}
137+
return true;
138+
};
139+
129140
def("buffer", 'B', no_argument, "Buffer requests.")
130141
.apply = [](const client_options &opt, const extended_option &ext, memcached_st *memc) {
131142
if (MEMCACHED_SUCCESS != memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, ext.set)) {

src/bin/memslap.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ int main(int argc, char *argv[]) {
242242
opt.add("noreply", 'R', no_argument, "Enable the NOREPLY behavior for storage commands.")
243243
.apply = [](const client_options &opt_, const client_options::extended_option &ext, memcached_st *memc) {
244244
if (MEMCACHED_SUCCESS != memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NOREPLY, ext.set)) {
245-
if(!opt_.isset("quiet")) {
245+
if (!opt_.isset("quiet")) {
246246
std::cerr << memcached_last_error_message(memc);
247247
}
248248
return false;

0 commit comments

Comments
 (0)