MCPcopy Create free account
hub / github.com/apple/foundationdb / LengthPrefixedStringRef

Class LengthPrefixedStringRef

fdbserver/include/fdbserver/LogSystem.h:707–727  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

705};
706
707struct LengthPrefixedStringRef {
708 // Represents a pointer to a string which is prefixed by a 4-byte length
709 // A LengthPrefixedStringRef is only pointer-sized (8 bytes vs 12 bytes for StringRef), but the corresponding string
710 // is 4 bytes bigger, and substring operations aren't efficient as they are with StringRef. It's a good choice when
711 // there might be lots of references to the same exact string.
712
713 uint32_t* length;
714
715 StringRef toStringRef() const {
716 ASSERT(length);
717 return StringRef((uint8_t*)(length + 1), *length);
718 }
719 int expectedSize() const {
720 ASSERT(length);
721 return *length;
722 }
723 uint32_t* getLengthPtr() const { return length; }
724
725 LengthPrefixedStringRef() : length(nullptr) {}
726 LengthPrefixedStringRef(uint32_t* length) : length(length) {}
727};
728
729// Structure to store serialized mutations sent from the proxy to the
730// transaction logs. The serialization repeats with the following format:

Callers 15

commitMessagesFunction · 0.85
peekMessagesFromMemoryFunction · 0.85
commitMessagesFunction · 0.85
peekMessagesFromMemoryFunction · 0.85
commitMessagesFunction · 0.85
peekMessagesFromMemoryFunction · 0.85
commitMessagesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected