common/limits.h (52 lines of code) (raw):
//
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef THIRD_PARTY_CLOUD_SPANNER_EMULATOR_COMMON_LIMITS_H_
#define THIRD_PARTY_CLOUD_SPANNER_EMULATOR_COMMON_LIMITS_H_
#include <cstdint>
namespace google {
namespace spanner {
namespace emulator {
namespace limits {
// Maximum number of cloud labels that can be assigned to a resource.
constexpr int kMaxNumCloudLabels = 64;
// Maximum size of an incoming gRPC message.
constexpr int64_t kMaxGRPCIncomingMessageSize = 100 * 1024 * 1024;
// Maximum size of an outgoing gRPC message.
constexpr int64_t kMaxGRPCOutgoingMessageSize = 100 * 1024 * 1024;
// Maxmimum size of a gRPC error message.
constexpr int64_t kMaxGRPCErrorMessageLength = 1024;
// Maximum number of outstanding transactions per session.
constexpr int kMaxTransactionsPerSession = 32;
// Maximum number of tables per database.
constexpr int kMaxTablesPerDatabase = 2560;
// Maximum number of change streams per database.
// https://cloud.google.com/spanner/quotas#change-streams
constexpr int kMaxChangeStreamsPerDatabase = 10;
// Maximum number of models per database.
// https://cloud.google.com/spanner/quotas#models
constexpr int kMaxModelsPerDatabase = 100;
constexpr int kMaxModelDefaultBatchSize = 10;
constexpr int kMaxStructFieldCount = 10;
constexpr int kMaxComplexTypeNestingDepth = 5;
// Maximum number of property graphs per database.
constexpr int kMaxPropertyGraphsPerDatabase = 16;
// Minimum retention duration supported for Change Streams in seconds.
constexpr int kChangeStreamsMinRetention = 60 * 60 * 24;
// Maximum retention duration supported for Change Streams.
constexpr int kChangeStreamsMaxRetention = 60 * 60 * 24 * 7;
// Minimum heartbeat milliseconds.
constexpr int64_t kChangeStreamsMinHeartbeatMilliseconds = 100;
// Maximum heartbeat milliseconds.
constexpr int64_t kChangeStreamsMaxHeartbeatMilliseconds = 300000;
// Maximum duration in minutes supported for change stream query to read into
// the future
constexpr int kChangeStreamsMaxStartTimestampDelay = 10;
// Maximum number of change streams per column.
constexpr int kMaxChangeStreamsTrackingATableOrColumn = 3;
// Maximum number of views per database.
// https://cloud.google.com/spanner/quotas#views.
constexpr int kMaxViewsPerDatabase = 5000;
// Maximum length of a schema identifier e.g. table/column/index name.
constexpr int kMaxSchemaIdentifierLength = 128;
// Maximum and minimum length of long-running operation IDs for schema changes.
constexpr int kDatabaseOpIdMinLength = 2;
constexpr int kDatabaseOpIdMaxLength = 128;
// Maximum number of columns per table.
constexpr int kMaxColumnsPerTable = 1024;
// Maximum number of key columns in a table.
constexpr int kMaxKeyColumns = 16;
// Maximum interleaving depth, counting from the top-level table's children.
constexpr int kMaxInterleavingDepth = 7;
// Maximum number of indexes per database.
constexpr int kMaxIndexesPerDatabase = kMaxTablesPerDatabase * 2;
// Maximum number of indexes per table.
constexpr int kMaxIndexesPerTable = 128;
// Maximum number of sessions that can be created in a batch.
constexpr int32_t kMaxBatchCreateSessionsCount = 100;
// Maximum number of databases for a given instance.
constexpr int kMaxDatabasesPerInstance = 100;
// Minimum database name length.
constexpr int kMinDatabaseNameLength = 2;
// Maximum database name length.
constexpr int kMaxDatabaseNameLength = 30;
// Minimum instance name length.
constexpr int kMinInstanceNameLength = 2;
// Maximum instance name length.
constexpr int kMaxInstanceNameLength = 64;
// Maximum length for a BYTES column value.
constexpr int kMaxBytesColumnLength = (10 << 20); // 10 MB
// Maximum length for a STRING column value.
constexpr int kMaxStringColumnLength = (kMaxBytesColumnLength / 4); // 2621440
// Maximum size of a response that is returned by a streaming read or query. If
// total aggregate response is larger than this limit it will be chunked into
// pieces, each no larger than this limit.
constexpr int64_t kMaxStreamingChunkSize = 1024 * 1024; // 1 MB
// Maximum size of a key in bytes.
constexpr int kMaxKeySizeBytes = 8 * 1024; // 8 KB
// Maximum size of the query string.
constexpr int kMaxQueryStringSize = 1024 * 1024; // 1 K
// Maximum depth of column expressions.
constexpr int kColumnExpressionMaxDepth = 20;
// Maximum number of attempts that the sequence API will try to retrieve a
// valid sequence value. This is used to fail fast in the case users set
// a very big skipped range, potentially skipping the whole positive int64_t
// value range.
constexpr int kMaxGetSequenceValueAttempt = 2000;
} // namespace limits
} // namespace emulator
} // namespace spanner
} // namespace google
#endif // THIRD_PARTY_CLOUD_SPANNER_EMULATOR_COMMON_LIMITS_H_