diff --git a/services/backup/docker-server/contents/server/src/Constants.h b/services/backup/docker-server/contents/server/src/Constants.h new file mode 100644 --- /dev/null +++ b/services/backup/docker-server/contents/server/src/Constants.h @@ -0,0 +1,34 @@ +#pragma once + +#include + +namespace comm { +namespace network { + +// 4MB limit +// WARNING: use keeping in mind that grpc adds its own headers to messages +// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md +// so the message that actually is being sent over the network looks like this +// [Compressed-Flag] [Message-Length] [Message] +// [Compressed-Flag] 1 byte - added by grpc +// [Message-Length] 4 bytes - added by grpc +// [Message] N bytes - actual data +// so for every message we get 5 additional bytes of data +// as mentioned here +// https://github.com/grpc/grpc/issues/15734#issuecomment-396962671 +// grpc stream may contain more than one message +const size_t GRPC_CHUNK_SIZE_LIMIT = 4 * 1024 * 1024; +const size_t GRPC_METADATA_SIZE_PER_MESSAGE = 5; +// 5MB limit +const size_t AWS_MULTIPART_UPLOAD_MINIMUM_CHUNK_SIZE = 5 * 1024 * 1024; + +const std::string AWS_REGION = "us-east-2"; + +#ifdef COMM_TEST_SERVICES +const std::string USER_PERSIST_TABLE_NAME = "backup-service-user-persist-test"; +#else +const std::string USER_PERSIST_TABLE_NAME = "backup-service-user-persist"; +#endif + +} // namespace network +} // namespace comm diff --git a/services/backup/docker-server/contents/server/src/Tools.h b/services/backup/docker-server/contents/server/src/Tools.h deleted file mode 100644 --- a/services/backup/docker-server/contents/server/src/Tools.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -namespace comm { -namespace network { - -// 4MB limit -const size_t GRPC_CHUNK_SIZE_LIMIT = 4 * 1024 * 1024; - -// 5MB limit -const size_t AWS_MULTIPART_UPLOAD_MINIMUM_CHUNK_SIZE = 5 * 1024 * 1024; - -enum class OBJECT_TYPE { - ENCRYPTED_BACKUP_KEY = 0, - TRANSACTION_LOGS = 1, - COMPACTION = 2, -}; - -class invalid_argument_error : public std::runtime_error { -public: - invalid_argument_error(std::string errorMessage) - : std::runtime_error(errorMessage) { - } -}; - -} // namespace network -} // namespace comm