@@ -130,9 +130,10 @@ const VISIBLE_MAX_VALUE_SIZE: usize = RAW_MAX_VALUE_SIZE
130130 - 1
131131 - 1 ;
132132
133- /// Fundamental constant in DynamoDB: The maximum size of a key is 1024 bytes
133+ /// Fundamental constant in DynamoDB: The maximum size of a key is 1024 bytes.
134+ /// We decrease by 1 because we append a [1] as prefix.
134135/// See https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html
135- const MAX_KEY_SIZE : usize = 1024 ;
136+ const MAX_KEY_SIZE : usize = 1023 ;
136137
137138/// Fundamental constants in DynamoDB: The maximum size of a [`TransactWriteItem`] is 4 MB.
138139/// See https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactWriteItems.html
@@ -203,7 +204,6 @@ fn build_key_value(
203204
204205/// Checks that a key is of the correct size
205206fn check_key_size ( key : & [ u8 ] ) -> Result < ( ) , DynamoDbStoreInternalError > {
206- ensure ! ( !key. is_empty( ) , DynamoDbStoreInternalError :: ZeroLengthKey ) ;
207207 ensure ! (
208208 key. len( ) <= MAX_KEY_SIZE ,
209209 DynamoDbStoreInternalError :: KeyTooLong
@@ -973,10 +973,6 @@ pub enum DynamoDbStoreInternalError {
973973 #[ error( "The transact must have length at most MAX_TRANSACT_WRITE_ITEM_SIZE" ) ]
974974 TransactUpperLimitSize ,
975975
976- /// Keys have to be of non-zero length.
977- #[ error( "The key must be of strictly positive length" ) ]
978- ZeroLengthKey ,
979-
980976 /// The key must have at most 1024 bytes
981977 #[ error( "The key must have at most 1024 bytes" ) ]
982978 KeyTooLong ,
@@ -985,10 +981,6 @@ pub enum DynamoDbStoreInternalError {
985981 #[ error( "The key prefix must have at most 1024 bytes" ) ]
986982 KeyPrefixTooLong ,
987983
988- /// Key prefixes have to be of non-zero length.
989- #[ error( "The key_prefix must be of strictly positive length" ) ]
990- ZeroLengthKeyPrefix ,
991-
992984 /// The journal is not coherent
993985 #[ error( transparent) ]
994986 JournalConsistencyError ( #[ from] JournalConsistencyError ) ,
0 commit comments