Skip to content

Commit 59eb5c1

Browse files
committed
frame/value: deprecate SerializeValuesError
This is part of the legacy serialization framework.
1 parent 04c6f31 commit 59eb5c1

File tree

2 files changed

+25
-22
lines changed

2 files changed

+25
-22
lines changed

scylla-cql/src/frame/value.rs

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,10 @@ use super::response::result::CqlValue;
1212
use super::types::vint_encode;
1313
use super::types::RawValue;
1414

15-
#[derive(Debug, Error, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
16-
#[error("Value too big to be sent in a request - max 2GiB allowed")]
17-
#[deprecated(
18-
since = "0.15.1",
19-
note = "Legacy serialization API is not type-safe and is going to be removed soon"
20-
)]
21-
pub struct ValueTooBig;
22-
2315
#[derive(Debug, Error, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
2416
#[error("Value is too large to fit in the CQL type")]
2517
pub struct ValueOverflow;
2618

27-
#[allow(deprecated)]
28-
#[derive(Debug, Error, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
29-
pub enum SerializeValuesError {
30-
#[error("Too many values to add, max 65,535 values can be sent in a request")]
31-
TooManyValues,
32-
#[error("Mixing named and not named values is not allowed")]
33-
MixingNamedAndNotNamedValues,
34-
#[error(transparent)]
35-
ValueTooBig(#[from] ValueTooBig),
36-
#[error("Parsing serialized values failed")]
37-
ParseError,
38-
}
39-
4019
/// Represents an unset value
4120
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
4221
pub struct Unset;
@@ -684,6 +663,22 @@ mod legacy {
684663
fn serialize(&self, buf: &mut Vec<u8>) -> Result<(), ValueTooBig>;
685664
}
686665

666+
#[derive(Debug, Error, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
667+
#[error("Value too big to be sent in a request - max 2GiB allowed")]
668+
pub struct ValueTooBig;
669+
670+
#[derive(Debug, Error, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
671+
pub enum SerializeValuesError {
672+
#[error("Too many values to add, max 65,535 values can be sent in a request")]
673+
TooManyValues,
674+
#[error("Mixing named and not named values is not allowed")]
675+
MixingNamedAndNotNamedValues,
676+
#[error(transparent)]
677+
ValueTooBig(#[from] ValueTooBig),
678+
#[error("Parsing serialized values failed")]
679+
ParseError,
680+
}
681+
687682
/// Keeps a buffer with serialized Values
688683
/// Allows adding new Values and iterating over serialized ones
689684
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
@@ -1887,5 +1882,6 @@ mod legacy {
18871882
pub use legacy::{
18881883
LegacyBatchValues, LegacyBatchValuesFirstSerialized, LegacyBatchValuesFromIter,
18891884
LegacyBatchValuesIterator, LegacyBatchValuesIteratorFromIterator, LegacySerializedValues,
1890-
LegacySerializedValuesIterator, SerializedResult, TupleValuesIter, Value, ValueList,
1885+
LegacySerializedValuesIterator, SerializeValuesError, SerializedResult, TupleValuesIter, Value,
1886+
ValueList, ValueTooBig,
18911887
};

scylla/src/transport/errors.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use std::{
1212
sync::Arc,
1313
};
1414

15+
#[allow(deprecated)]
1516
use scylla_cql::{
1617
frame::{
1718
frame_errors::{
@@ -124,6 +125,7 @@ pub enum QueryError {
124125
IntoLegacyQueryResultError(#[from] IntoLegacyQueryResultError),
125126
}
126127

128+
#[allow(deprecated)]
127129
impl From<SerializeValuesError> for QueryError {
128130
fn from(serialized_err: SerializeValuesError) -> QueryError {
129131
QueryError::BadQuery(BadQuery::SerializeValuesError(serialized_err))
@@ -573,7 +575,12 @@ pub enum ViewsMetadataError {
573575
#[non_exhaustive]
574576
pub enum BadQuery {
575577
/// Failed to serialize values passed to a query - values too big
578+
#[deprecated(
579+
since = "0.15.1",
580+
note = "Legacy serialization API is not type-safe and is going to be removed soon"
581+
)]
576582
#[error("Serializing values failed: {0} ")]
583+
#[allow(deprecated)]
577584
SerializeValuesError(#[from] SerializeValuesError),
578585

579586
#[error("Serializing values failed: {0} ")]

0 commit comments

Comments
 (0)