MCPcopy Create free account
hub / github.com/apache/mesos / encode

Function encode

src/log/leveldb.cpp:88–104  ·  view source on GitHub ↗

Returns a string representing the specified position. Note that we adjust the actual position by incrementing it by 1 because we reserve 0 for storing the promise record (Record::Promise, DEPRECATED!), or the metadata (Record::Metadata).

Source from the content-addressed store, hash-verified

86// reserve 0 for storing the promise record (Record::Promise,
87// DEPRECATED!), or the metadata (Record::Metadata).
88static string encode(uint64_t position, bool adjust = true)
89{
90 // Adjusted stringified represenation is plus 1 of actual position.
91 position = adjust ? position + 1 : position;
92
93 // TODO(benh): Use varint encoding for VarInt64Comparator!
94 // string s;
95 // google::protobuf::io::StringOutputStream _stream(&s);
96 // google::protobuf::io::CodedOutputStream stream(&_stream);
97 // position = adjust ? position + 1 : position;
98 // stream.WriteVarint64(position);
99 // return s;
100
101 Try<string> s = strings::format("%.*d", 10, position);
102 CHECK_SOME(s);
103 return s.get();
104}
105
106
107// Returns the position as represented in the specified slice

Callers 15

restoreMethod · 0.70
persistMethod · 0.70
readMethod · 0.70
authenticateMethod · 0.50
TYPED_TESTFunction · 0.50
TESTFunction · 0.50
TEST_FFunction · 0.50
TEST_FFunction · 0.50
TEST_FFunction · 0.50
createBasicAuthHeadersFunction · 0.50
TEST_FFunction · 0.50

Calls 2

formatFunction · 0.85
getMethod · 0.45

Tested by 11

TYPED_TESTFunction · 0.40
TESTFunction · 0.40
TEST_FFunction · 0.40
TEST_FFunction · 0.40
TEST_FFunction · 0.40
createBasicAuthHeadersFunction · 0.40
TEST_FFunction · 0.40
TESTFunction · 0.40
getVolumePathMethod · 0.40
createVolumeMethod · 0.40