Skip to content

Commit 7f35a86

Browse files
committed
redis lua
1 parent 70dc648 commit 7f35a86

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2625
-572
lines changed

bench/hiredis/hiredissync.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -425,14 +425,14 @@ void testThroughPut()
425425

426426
int main(int argc, char* argv[])
427427
{
428-
#ifdef _WIN64
429-
WSADATA wsaData;
430-
int32_t iRet = WSAStartup(MAKEWORD(2, 2), &wsaData);
431-
assert(iRet == 0);
432-
#else
433-
signal(SIGPIPE, SIG_IGN);
434-
signal(SIGHUP, SIG_IGN);
435-
#endif
428+
#ifdef _WIN64
429+
WSADATA wsaData;
430+
int32_t iRet = WSAStartup(MAKEWORD(2, 2), &wsaData);
431+
assert(iRet == 0);
432+
#else
433+
signal(SIGPIPE, SIG_IGN);
434+
signal(SIGHUP, SIG_IGN);
435+
#endif
436436

437437
struct timeval timeout = { 1, 500000 }; // 1.5 seconds
438438

example/hiredis/hiredistest.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -390,14 +390,14 @@ void HiredisTest::list()
390390

391391
int main(int argc, char *argv[])
392392
{
393-
#ifdef _WIN64
394-
WSADATA wsaData;
395-
int32_t iRet = WSAStartup(MAKEWORD(2, 2), &wsaData);
396-
assert(iRet == 0);
397-
#else
398-
signal(SIGPIPE, SIG_IGN);
399-
signal(SIGHUP, SIG_IGN);
400-
#endif
393+
#ifdef _WIN64
394+
WSADATA wsaData;
395+
int32_t iRet = WSAStartup(MAKEWORD(2, 2), &wsaData);
396+
assert(iRet == 0);
397+
#else
398+
signal(SIGPIPE, SIG_IGN);
399+
signal(SIGHUP, SIG_IGN);
400+
#endif
401401

402402
const char *ip = "127.0.0.1";
403403
uint16_t port = 6379;

example/http/httptest.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void onMessage(const HttpRequest &req, HttpResponse *resp)
2424
if (req.getPath() == "/")
2525
{
2626
printf("");
27-
resp->setStatusCode(HttpResponse::k2000k);
27+
resp->setStatusCode(HttpResponse::k200k);
2828
resp->setStatusMessage("OK");
2929
resp->setContentType("text/html");
3030
resp->addHeader("Server", "xHttp");
@@ -35,14 +35,14 @@ void onMessage(const HttpRequest &req, HttpResponse *resp)
3535
}
3636
else if (req.getPath() == "/favicon.ico")
3737
{
38-
resp->setStatusCode(HttpResponse::k2000k);
38+
resp->setStatusCode(HttpResponse::k200k);
3939
resp->setStatusMessage("OK");
4040
resp->setContentType("image/png");
4141
resp->setBody(std::string(favicon, sizeof favicon));
4242
}
4343
else if (req.getPath() == "/hello")
4444
{
45-
resp->setStatusCode(HttpResponse::k2000k);
45+
resp->setStatusCode(HttpResponse::k200k);
4646
resp->setStatusMessage("OK");
4747
resp->setContentType("text/plain");
4848
resp->addHeader("Server", "xHttp");
@@ -52,7 +52,7 @@ void onMessage(const HttpRequest &req, HttpResponse *resp)
5252
{
5353
std::string filename = "attachment;filename=";
5454
filename += "test.txt";
55-
resp->setStatusCode(HttpResponse::k2000k);
55+
resp->setStatusCode(HttpResponse::k200k);
5656
resp->setStatusMessage("OK");
5757
resp->setContentType("text/plain");
5858
resp->addHeader("Content-Disposition", filename);
@@ -67,7 +67,7 @@ void onMessage(const HttpRequest &req, HttpResponse *resp)
6767
}
6868
else if (req.getMethod() == HttpRequest::kPost)
6969
{
70-
resp->setStatusCode(HttpResponse::k2000k);
70+
resp->setStatusCode(HttpResponse::k200k);
7171
resp->setStatusMessage("OK");
7272
}
7373
}

example/leveldb/src/block.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class BlockIterator : public Iterator
6060

6161
inline int compare(const std::string_view &a, const std::string_view &b) const
6262
{
63-
//return comparator->compare(a, b);
63+
return comparator->compare(a, b);
6464

6565
int r = comparator->compare(extractUserKey(a), extractUserKey(b));
6666
if (r == 0)
@@ -80,7 +80,6 @@ class BlockIterator : public Iterator
8080
return r;
8181
}
8282

83-
8483
// Return the offset in data_ just past the end of the current entry.
8584
inline uint32_t nextEntryOffset() const
8685
{
@@ -129,7 +128,7 @@ class BlockIterator : public Iterator
129128
{
130129
clearnups.push_back(arg);
131130
}
132-
131+
133132
virtual bool valid() const { return current < restarts; }
134133
virtual Status status() const { return s; }
135134
virtual std::string_view key() const

example/leveldb/src/dbformat.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ int InternalKeyComparator::compare(const std::string_view &akey, const std::stri
130130
// increasing user key (according to user-supplied comparator)
131131
// decreasing sequence number
132132
// decreasing type (though sequence# should be enough to disambiguate)
133-
return comparator->compare(extractUserKey(akey), extractUserKey(bkey));
134133
int r = comparator->compare(extractUserKey(akey), extractUserKey(bkey));
135134
if (r == 0)
136135
{

example/leveldb/src/dbformat.h

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,15 @@ class Comparator
125125
class BytewiseComparatorImpl : public Comparator
126126
{
127127
public:
128-
explicit BytewiseComparatorImpl() { }
129-
virtual ~BytewiseComparatorImpl() { }
128+
explicit BytewiseComparatorImpl()
129+
{
130+
131+
}
132+
133+
virtual ~BytewiseComparatorImpl()
134+
{
135+
136+
}
130137
virtual const char *name() const { return "leveldb.BytewiseComparator"; }
131138
virtual int compare(const std::string_view &a, const std::string_view &b) const
132139
{
@@ -141,14 +148,22 @@ class BytewiseComparatorImpl : public Comparator
141148
class InternalKeyComparator : public Comparator
142149
{
143150
public:
144-
explicit InternalKeyComparator(const Comparator *c) : comparator(c) { }
145-
virtual ~InternalKeyComparator() { }
151+
explicit InternalKeyComparator(const Comparator *c)
152+
: comparator(c)
153+
{
154+
155+
}
156+
157+
virtual ~InternalKeyComparator()
158+
{
159+
160+
}
146161

147162
virtual const char *name() const;
148163
virtual void findShortestSeparator(std::string *start, const std::string_view &limit) const;
149164
virtual void findShortSuccessor(std::string *key) const;
150165
virtual int compare(const std::string_view &a, const std::string_view &b) const;
151-
virtual int compare(const InternalKey &a, const InternalKey &b) const;
166+
virtual int compare1(const InternalKey &a, const InternalKey &b) const;
152167
const Comparator *getComparator() const { return comparator; }
153168

154169
private:
@@ -189,7 +204,7 @@ class InternalKey
189204
void clear() { rep.clear(); }
190205
};
191206

192-
inline int InternalKeyComparator::compare(const InternalKey &a, const InternalKey &b) const
207+
inline int InternalKeyComparator::compare1(const InternalKey &a, const InternalKey &b) const
193208
{
194209
return compare(a.encode(), b.encode());
195210
}

0 commit comments

Comments
 (0)