Class Size
Represents the amount of digital storage.
public class Size : DeputyBase
- Inheritance
-
Size
Examples
Bucket bucket;
// Provide a Lambda function that will transform records before delivery, with custom
// buffering and retry configuration
var lambdaFunction = new Function(this, "Processor", new FunctionProps {
Runtime = Runtime.NODEJS_14_X,
Handler = "index.handler",
Code = Code.FromAsset(Join(__dirname, "process-records"))
});
var lambdaProcessor = new LambdaFunctionProcessor(lambdaFunction, new DataProcessorProps {
BufferInterval = Duration.Minutes(5),
BufferSize = Size.Mebibytes(5),
Retries = 5
});
var s3Destination = new S3Bucket(bucket, new S3BucketProps {
Processor = lambdaProcessor
});
new DeliveryStream(this, "Delivery Stream", new DeliveryStreamProps {
Destinations = new [] { s3Destination }
});
Remarks
The amount can be specified either as a literal value (e.g: 10
) which
cannot be negative, or as an unresolved number token.
When the amount is passed as a token, unit conversion is not possible.
ExampleMetadata: infused
Methods
Gibibytes(double)
Create a Storage representing an amount gibibytes.
public static Size Gibibytes(double amount)
Parameters
amount
doublethe amount of gibibytes to be represented.
Returns
- Size
a new
Size
instance
Remarks
1 GiB = 1024 MiB
IsUnresolved()
Checks if size is a token or a resolvable object.
public virtual bool IsUnresolved()
Returns
Kibibytes(double)
Create a Storage representing an amount kibibytes.
public static Size Kibibytes(double amount)
Parameters
amount
doublethe amount of kibibytes to be represented.
Returns
- Size
a new
Size
instance
Remarks
1 KiB = 1024 bytes
Mebibytes(double)
Create a Storage representing an amount mebibytes.
public static Size Mebibytes(double amount)
Parameters
amount
doublethe amount of mebibytes to be represented.
Returns
- Size
a new
Size
instance
Remarks
1 MiB = 1024 KiB
Pebibyte(double)
(deprecated) Create a Storage representing an amount pebibytes.
[Obsolete("use `pebibytes` instead")]
public static Size Pebibyte(double amount)
Parameters
amount
double
Returns
Remarks
1 PiB = 1024 TiB
Stability: Deprecated
Pebibytes(double)
Create a Storage representing an amount pebibytes.
public static Size Pebibytes(double amount)
Parameters
amount
doublethe amount of pebibytes to be represented.
Returns
- Size
a new
Size
instance
Remarks
1 PiB = 1024 TiB
Tebibytes(double)
Create a Storage representing an amount tebibytes.
public static Size Tebibytes(double amount)
Parameters
amount
doublethe amount of tebibytes to be represented.
Returns
- Size
a new
Size
instance
Remarks
1 TiB = 1024 GiB
ToGibibytes(ISizeConversionOptions?)
Return this storage as a total number of gibibytes.
public virtual double ToGibibytes(ISizeConversionOptions? opts = null)
Parameters
opts
ISizeConversionOptionsthe conversion options.
Returns
- double
the quantity of bytes expressed in gibibytes
ToKibibytes(ISizeConversionOptions?)
Return this storage as a total number of kibibytes.
public virtual double ToKibibytes(ISizeConversionOptions? opts = null)
Parameters
opts
ISizeConversionOptionsthe conversion options.
Returns
- double
the quantity of bytes expressed in kibibytes
ToMebibytes(ISizeConversionOptions?)
Return this storage as a total number of mebibytes.
public virtual double ToMebibytes(ISizeConversionOptions? opts = null)
Parameters
opts
ISizeConversionOptionsthe conversion options.
Returns
- double
the quantity of bytes expressed in mebibytes
ToPebibytes(ISizeConversionOptions?)
Return this storage as a total number of pebibytes.
public virtual double ToPebibytes(ISizeConversionOptions? opts = null)
Parameters
opts
ISizeConversionOptionsthe conversion options.
Returns
- double
the quantity of bytes expressed in pebibytes
ToTebibytes(ISizeConversionOptions?)
Return this storage as a total number of tebibytes.
public virtual double ToTebibytes(ISizeConversionOptions? opts = null)
Parameters
opts
ISizeConversionOptionsthe conversion options.
Returns
- double
the quantity of bytes expressed in tebibytes