mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-25 14:31:35 +00:00
24bcab7d5d
Summary: The patch adds support for wide-column entities to the existing query APIs (`Get`, `MultiGet`, and iterator). Namely, when during a query a wide-column entity is encountered, we will return the value of the default (anonymous) column as the result. Later, we plan to add wide-column specific query APIs which will enable retrieving entire wide-column entities or a subset of their columns. Pull Request resolved: https://github.com/facebook/rocksdb/pull/10483 Test Plan: `make check` Reviewed By: riversand963 Differential Revision: D38441881 Pulled By: ltamasi fbshipit-source-id: 6444e79a31aff2470e866698e3a97985bc2b3543
57 lines
2.2 KiB
C++
57 lines
2.2 KiB
C++
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
// This source code is licensed under both the GPLv2 (found in the
|
|
// COPYING file in the root directory) and Apache 2.0 License
|
|
// (found in the LICENSE.Apache file in the root directory).
|
|
|
|
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
#include "rocksdb/rocksdb_namespace.h"
|
|
#include "rocksdb/status.h"
|
|
#include "rocksdb/wide_columns.h"
|
|
|
|
namespace ROCKSDB_NAMESPACE {
|
|
|
|
class Slice;
|
|
|
|
// Wide-column serialization/deserialization primitives.
|
|
//
|
|
// The two main parts of the layout are 1) a sorted index containing the column
|
|
// names and column value sizes and 2) the column values themselves. Keeping the
|
|
// index and the values separate will enable selectively reading column values
|
|
// down the line. Note that currently the index has to be fully parsed in order
|
|
// to find out the offset of each column value.
|
|
//
|
|
// Legend: cn = column name, cv = column value, cns = column name size, cvs =
|
|
// column value size.
|
|
//
|
|
// +----------+--------------+----------+-------+----------+---...
|
|
// | version | # of columns | cns 1 | cn 1 | cvs 1 |
|
|
// +----------+--------------+------------------+--------- +---...
|
|
// | varint32 | varint32 | varint32 | bytes | varint32 |
|
|
// +----------+--------------+----------+-------+----------+---...
|
|
//
|
|
// ... continued ...
|
|
//
|
|
// ...---+----------+-------+----------+-------+---...---+-------+
|
|
// | cns N | cn N | cvs N | cv 1 | | cv N |
|
|
// ...---+----------+-------+----------+-------+---...---+-------+
|
|
// | varint32 | bytes | varint32 | bytes | | bytes |
|
|
// ...---+----------+-------+----------+-------+---...---+-------+
|
|
|
|
class WideColumnSerialization {
|
|
public:
|
|
static Status Serialize(const WideColumns& columns, std::string& output);
|
|
static Status Deserialize(Slice& input, WideColumns& columns);
|
|
|
|
static WideColumns::const_iterator Find(const WideColumns& columns,
|
|
const Slice& column_name);
|
|
static Status GetValueOfDefaultColumn(Slice& input, Slice& value);
|
|
|
|
static constexpr uint32_t kCurrentVersion = 1;
|
|
};
|
|
|
|
} // namespace ROCKSDB_NAMESPACE
|