Cascade
Loading...
Searching...
No Matches
Buzzware.Cascade.RequestOp Class Reference

Represents a request operation in the Cascade library. It encapsulates all necessary details such as the type, verb, id, value, etc. More...

Public Member Functions

 RequestOp (long timeMs, Type? type, RequestVerb verb, object? id, object? value=null, IEnumerable< string >? populate=null, int? freshnessSeconds=null, int? populateFreshnessSeconds=null, int? fallbackFreshnessSeconds=null, bool? hold=null, object? criteria=null, string? key=null, object? extra=null, string? eTag=null, bool? localOnly=null)
 Initializes a new instance of the RequestOp class with the provided details.
RequestOp CloneWith (long? timeMs=null, Type? type=null, RequestVerb? verb=null, object? id=null, object? value=null, IEnumerable< string >? populate=null, int? freshnessSeconds=null, int? populateFreshnessSeconds=null, int? fallbackFreshnessSeconds=null, bool? hold=null, object? criteria=null, string? key=null, object? extra=null, string? eTag=null, bool? localOnly=null)
 Creates a new instance of RequestOp by cloning the current instance and optionally modifying its properties.
string ToSummaryString ()
 Converts the operation details into a concise summary string for logging or display purposes.

Static Public Member Functions

static RequestOp GetOp< Model > (object id, long timeMs=-1, IEnumerable< string >? populate=null, int? freshnessSeconds=null, int? populateFreshnessSeconds=null, int? fallbackFreshnessSeconds=null, bool? hold=null, object? criteria=null, bool? localOnly=null)
 Constructs a "Get" operation for a specific model type, with optional parameters for population and freshness.
static RequestOp GetOp (Type modelType, object id, long timeMs=-1, IEnumerable< string >? populate=null, int? freshnessSeconds=null, int? populateFreshnessSeconds=null, int? fallbackFreshnessSeconds=null, bool? hold=null, object? criteria=null, bool? localOnly=null)
 Constructs a "Get" operation for a specified type with additional configuration options.
static RequestOp BlobGetOp (string path, long timeMs=-1, int? freshnessSeconds=null, int? fallbackFreshnessSeconds=null, bool? hold=null, string? eTag=null, bool? localOnly=null)
 Constructs a "BlobGet" operation for retrieving a binary large object at a specified path.
static RequestOp BlobGetFilePathOp (string path, long timeMs=-1, int? freshnessSeconds=null, int? fallbackFreshnessSeconds=null, bool? hold=null, string? eTag=null, bool? localOnly=null)
 Constructs a "BlobGetFilePath" operation for retrieving the absolute path to a binary large object at a specified path.
static RequestOp BlobPutOp (string path, long timeMs, object? data, bool? hold=null, object? criteria=null, bool? localOnly=null)
 Constructs a "BlobPut" operation for storing a binary large object at a specified path.
static RequestOp BlobDestroyOp (string path, long timeMs, object? criteria=null)
 Constructs a "BlobDestroy" operation for deleting a binary large object at a specified path.
static RequestOp GetCollectionOp< Model > (string collectionName, long timeMs=-1, int? freshnessSeconds=null, int? fallbackFreshnessSeconds=null)
 Constructs a "GetCollection" operation for retrieving a collection of model ids.
static RequestOp QueryOp< Model > (string? collectionName, object? criteria, long timeMs, IEnumerable< string >? populate=null, int? freshnessSeconds=null, int? populateFreshnessSeconds=null, int? fallbackFreshnessSeconds=null, bool? hold=null, bool? localOnly=null)
 Constructs a "Query" operation for querying a collection of models with specific criteria.
static RequestOp CreateOp (object model, long timeMs, bool hold=false, object? criteria=null, bool? localOnly=null)
 Constructs a "Create" operation for creating a new model instance.
static RequestOp DestroyOp< Model > (Model model, long timeMs, object? criteria=null, bool? localOnly=null)
 Constructs a "Destroy" operation for deleting a specified model instance.
static RequestOp ReplaceOp< Model > (Model model, long timeMs, object? criteria=null, bool? localOnly=null)
 Constructs a "Replace" operation for replacing an existing model instance.
static RequestOp UpdateOp< Model > (Model model, IDictionary< string, object?> changes, long timeMs, object? criteria=null, bool? localOnly=null)
 Constructs an "Update" operation for updating an existing model instance with specified changes.
static RequestOp ExecuteOp< OriginClass, ReturnType > (string action, IDictionary< string, object?> parameters, long timeMs)
 Constructs an "Execute" operation to perform a custom action with specified parameters.
static bool IsWriteVerb (RequestVerb aVerb)
 Determines if a specified RequestVerb is associated with write operations such as Create, Update, or Execute.
static RequestVerb VerbFromString (string aString)
 Parses a string to a corresponding RequestVerb. If parsing fails, it returns RequestVerb.None.

Public Attributes

readonly long TimeMs
readonly? Type Type
readonly RequestVerb Verb
readonly? object Id
readonly? object Value
readonly? string Key
readonly? object Criteria
readonly? object Extra
readonly? string ETag
readonly? bool LocalOnly
readonly? IEnumerable< string > Populate
readonly int FreshnessSeconds = FRESHNESS_DEFAULT
readonly int PopulateFreshnessSeconds = FRESHNESS_DEFAULT
readonly int FallbackFreshnessSeconds = FALLBACK_ANY
readonly bool Hold
readonly IDictionary< string, string > Params
readonly long FreshAfterMs
readonly long PopulateFreshAfterMs
readonly long FallbackFreshAfterMs

Static Public Attributes

const int FRESHNESS_DEFAULT = 5*60
const int FRESHNESS_ANY = int.MaxValue
const int FRESHNESS_FRESHEST = 0
const int FRESHNESS_INSIST = -1
const int FALLBACK_NEVER = -1
const int FALLBACK_ANY = FRESHNESS_ANY
const int FALLBACK_DEFAULT = FALLBACK_ANY

Properties

int? IdAsInt [get]
 Attempts to return the Id field as an integer, if it can be interpreted as such.
long? IdAsLong [get]
 Attempts to return the Id field as a long, if it can be interpreted as such.
String? IdAsString [get]
 Attempts to return the Id field as a string, if it can be interpreted as long or int.

Detailed Description

Represents a request operation in the Cascade library. It encapsulates all necessary details such as the type, verb, id, value, etc.

Constructor & Destructor Documentation

◆ RequestOp()

Buzzware.Cascade.RequestOp.RequestOp ( long timeMs,
Type? type,
RequestVerb verb,
object? id,
object? value = null,
IEnumerable< string >? populate = null,
int? freshnessSeconds = null,
int? populateFreshnessSeconds = null,
int? fallbackFreshnessSeconds = null,
bool? hold = null,
object? criteria = null,
string? key = null,
object? extra = null,
string? eTag = null,
bool? localOnly = null )
inline

Initializes a new instance of the RequestOp class with the provided details.

Parameters
timeMsThe timestamp in milliseconds when the request was created.
typeThe type of the model associated with the request.
verbThe operation type represented by a verb.
idThe identifier of the model for requests involving a specific instance.
valueThe value associated with the request, such as the model or changes.
populateA collection indicating associations to be populated, if applicable.
freshnessSecondsDesired freshness of the returned data in seconds.
populateFreshnessSecondsDesired freshness for populated relations in seconds.
fallbackFreshnessSecondsFallback freshness in seconds to use if main freshness cannot be satisfied.
holdSpecifies whether the request should be held for deferred processing.
criteriaCriteria for filtering results in certain operations like queries.
keyIdentifier for collection-level operations instead of individual instances.
extraAny additional data required by the request.
eTag
localOnly

Member Function Documentation

◆ BlobDestroyOp()

RequestOp Buzzware.Cascade.RequestOp.BlobDestroyOp ( string path,
long timeMs,
object? criteria = null )
inlinestatic

Constructs a "BlobDestroy" operation for deleting a binary large object at a specified path.

Parameters
pathThe path of the blob to be deleted.
timeMsThe timestamp in milliseconds when the request was created.
criteria
Returns
A new instance of RequestOp representing a "BlobDestroy" request.

◆ BlobGetFilePathOp()

RequestOp Buzzware.Cascade.RequestOp.BlobGetFilePathOp ( string path,
long timeMs = -1,
int? freshnessSeconds = null,
int? fallbackFreshnessSeconds = null,
bool? hold = null,
string? eTag = null,
bool? localOnly = null )
inlinestatic

Constructs a "BlobGetFilePath" operation for retrieving the absolute path to a binary large object at a specified path.

Parameters
pathThe path of the blob to be retrieved.
timeMsThe timestamp in milliseconds when the request was created. If not specified, the current time is used.
freshnessSecondsIndicates how fresh the blob data should be. Defaults to FRESHNESS_DEFAULT if not provided.
fallbackFreshnessSecondsFallback freshness requirement if the main requirement cannot be met. Defaults to FRESHNESS_ANY.
holdSpecifies if the request should be held from processing. Defaults to null.
eTag
localOnly
Returns
A new instance of RequestOp representing a "BlobGet" request.

◆ BlobGetOp()

RequestOp Buzzware.Cascade.RequestOp.BlobGetOp ( string path,
long timeMs = -1,
int? freshnessSeconds = null,
int? fallbackFreshnessSeconds = null,
bool? hold = null,
string? eTag = null,
bool? localOnly = null )
inlinestatic

Constructs a "BlobGet" operation for retrieving a binary large object at a specified path.

Parameters
pathThe path of the blob to be retrieved.
timeMsThe timestamp in milliseconds when the request was created. If not specified, the current time is used.
freshnessSecondsIndicates how fresh the blob data should be. Defaults to FRESHNESS_DEFAULT if not provided.
fallbackFreshnessSecondsFallback freshness requirement if the main requirement cannot be met. Defaults to FRESHNESS_ANY.
holdSpecifies if the request should be held from processing. Defaults to null.
eTag
localOnly
Returns
A new instance of RequestOp representing a "BlobGet" request.

◆ BlobPutOp()

RequestOp Buzzware.Cascade.RequestOp.BlobPutOp ( string path,
long timeMs,
object? data,
bool? hold = null,
object? criteria = null,
bool? localOnly = null )
inlinestatic

Constructs a "BlobPut" operation for storing a binary large object at a specified path.

Parameters
pathThe path where the blob will be stored.
timeMsThe timestamp in milliseconds when the request was created.
dataThe byte array or stream representing the blob data to be stored.
holdSpecifies if the request should be held from processing. Defaults to null.
criteria
localOnly
Returns
A new instance of RequestOp representing a "BlobPut" request.

◆ CloneWith()

RequestOp Buzzware.Cascade.RequestOp.CloneWith ( long? timeMs = null,
Type? type = null,
RequestVerb? verb = null,
object? id = null,
object? value = null,
IEnumerable< string >? populate = null,
int? freshnessSeconds = null,
int? populateFreshnessSeconds = null,
int? fallbackFreshnessSeconds = null,
bool? hold = null,
object? criteria = null,
string? key = null,
object? extra = null,
string? eTag = null,
bool? localOnly = null )
inline

Creates a new instance of RequestOp by cloning the current instance and optionally modifying its properties.

Parameters
timeMsOptional new timestamp in milliseconds.
typeOptional new model type.
verbOptional new operation type.
idOptional new model identifier.
valueOptional new value associated with the request.
populateOptional new relationships to populate.
freshnessSecondsOptional new freshness requirement in seconds.
populateFreshnessSecondsOptional new populate freshness in seconds.
fallbackFreshnessSecondsOptional new fallback freshness in seconds.
holdOptional new hold status.
criteriaOptional new criteria.
keyOptional new key for collection operations.
extraOptional new extra data.
eTag
localOnly
Returns
A cloned instance of RequestOp with optional modifications.

◆ CreateOp()

RequestOp Buzzware.Cascade.RequestOp.CreateOp ( object model,
long timeMs,
bool hold = false,
object? criteria = null,
bool? localOnly = null )
inlinestatic

Constructs a "Create" operation for creating a new model instance.

Parameters
modelThe model instance to be created.
timeMsThe timestamp in milliseconds when the request was created.
holdSpecifies if the request should be held from processing.
criteria
localOnly
Returns
A new instance of RequestOp representing a "Create" request.

◆ DestroyOp< Model >()

RequestOp Buzzware.Cascade.RequestOp.DestroyOp< Model > ( Model model,
long timeMs,
object? criteria = null,
bool? localOnly = null )
inlinestatic

Constructs a "Destroy" operation for deleting a specified model instance.

Template Parameters
ModelThe type of the model to be deleted.
Parameters
modelThe model instance to be deleted.
timeMsThe timestamp in milliseconds when the request was created.
criteria
localOnly
Returns
A new instance of RequestOp representing a "Destroy" request.

◆ ExecuteOp< OriginClass, ReturnType >()

RequestOp Buzzware.Cascade.RequestOp.ExecuteOp< OriginClass, ReturnType > ( string action,
IDictionary< string, object?> parameters,
long timeMs )
inlinestatic

Constructs an "Execute" operation to perform a custom action with specified parameters.

Template Parameters
OriginClassThe class from which the action originates.
ReturnTypeThe expected return type from executing the action.
Parameters
actionThe name of the action to be executed.
parametersA dictionary containing parameters required for the action.
timeMsThe timestamp in milliseconds when the request was created.
Returns
A new instance of RequestOp representing an "Execute" request.

◆ GetCollectionOp< Model >()

RequestOp Buzzware.Cascade.RequestOp.GetCollectionOp< Model > ( string collectionName,
long timeMs = -1,
int? freshnessSeconds = null,
int? fallbackFreshnessSeconds = null )
inlinestatic

Constructs a "GetCollection" operation for retrieving a collection of model ids.

Template Parameters
ModelThe type of the model
Parameters
collectionNameThe name of the collection to be retrieved.
timeMsThe timestamp in milliseconds when the request was created. If not specified, the current time is used.
freshnessSeconds
populateFreshnessSeconds
fallbackFreshnessSeconds
Returns
A new instance of RequestOp representing a "GetCollection" request.

◆ GetOp()

RequestOp Buzzware.Cascade.RequestOp.GetOp ( Type modelType,
object id,
long timeMs = -1,
IEnumerable< string >? populate = null,
int? freshnessSeconds = null,
int? populateFreshnessSeconds = null,
int? fallbackFreshnessSeconds = null,
bool? hold = null,
object? criteria = null,
bool? localOnly = null )
inlinestatic

Constructs a "Get" operation for a specified type with additional configuration options.

Parameters
modelTypeThe type of the model to be retrieved.
idThe identifier for the model to be retrieved.
timeMsThe timestamp in milliseconds when the request was created. If not specified, the current time is used.
populateAssociations to be populated along with the model.
freshnessSecondsIndicates how fresh the data should be. Defaults to FRESHNESS_DEFAULT if not provided.
populateFreshnessSecondsSpecific freshness requirement for populated relations. Defaults to FRESHNESS_DEFAULT if not provided.
fallbackFreshnessSecondsFallback freshness requirement if the main requirement cannot be met. Defaults to FRESHNESS_ANY.
holdSpecifies if the request should be held from processing. Defaults to null.
criteria
localOnly
Returns
A new instance of RequestOp representing a "Get" request.

◆ GetOp< Model >()

RequestOp Buzzware.Cascade.RequestOp.GetOp< Model > ( object id,
long timeMs = -1,
IEnumerable< string >? populate = null,
int? freshnessSeconds = null,
int? populateFreshnessSeconds = null,
int? fallbackFreshnessSeconds = null,
bool? hold = null,
object? criteria = null,
bool? localOnly = null )
inlinestatic

Constructs a "Get" operation for a specific model type, with optional parameters for population and freshness.

Template Parameters
ModelThe type of the model to be retrieved.
Parameters
idThe identifier for the model to be retrieved.
timeMsThe timestamp in milliseconds when the request was created. If not specified, the current time is used.
populateCollection of string relations to be populated along with the model.
freshnessSecondsIndicates how fresh the data should be. Defaults to FRESHNESS_DEFAULT if not provided.
populateFreshnessSecondsSpecific freshness requirement for populated relations. Defaults to FRESHNESS_DEFAULT if not provided.
fallbackFreshnessSecondsFallback freshness requirement if the main requirement cannot be met. Defaults to FRESHNESS_ANY.
holdSpecifies if the request should be held from processing. Defaults to null.
criteria
localOnly
Returns
A new instance of RequestOp representing a "Get" request.

◆ IsWriteVerb()

bool Buzzware.Cascade.RequestOp.IsWriteVerb ( RequestVerb aVerb)
inlinestatic

Determines if a specified RequestVerb is associated with write operations such as Create, Update, or Execute.

Parameters
aVerbThe RequestVerb to be checked.
Returns
bool indicating whether the verb is associated with a write operation.

◆ QueryOp< Model >()

RequestOp Buzzware.Cascade.RequestOp.QueryOp< Model > ( string? collectionName,
object? criteria,
long timeMs,
IEnumerable< string >? populate = null,
int? freshnessSeconds = null,
int? populateFreshnessSeconds = null,
int? fallbackFreshnessSeconds = null,
bool? hold = null,
bool? localOnly = null )
inlinestatic

Constructs a "Query" operation for querying a collection of models with specific criteria.

Template Parameters
ModelThe type of the models in the collection.
Parameters
collectionNameThe name of the collection to be queried.
criteriaThe criteria used to filter models within the collection.
timeMsThe timestamp in milliseconds when the request was created.
populateCollection of string relations to be populated along with the models.
freshnessSecondsIndicates how fresh the data should be. Defaults to FRESHNESS_DEFAULT if not provided.
populateFreshnessSecondsSpecific freshness requirement for populated relations. Defaults to FRESHNESS_DEFAULT if not provided.
fallbackFreshnessSecondsFallback freshness requirement if the main requirement cannot be met. Defaults to FRESHNESS_ANY.
holdSpecifies if the request should be held from processing. Defaults to null.
localOnly
Returns
A new instance of RequestOp representing a "Query" request.

◆ ReplaceOp< Model >()

RequestOp Buzzware.Cascade.RequestOp.ReplaceOp< Model > ( Model model,
long timeMs,
object? criteria = null,
bool? localOnly = null )
inlinestatic

Constructs a "Replace" operation for replacing an existing model instance.

Template Parameters
ModelThe type of the model to be replaced.
Parameters
modelThe model instance to be replaced.
timeMsThe timestamp in milliseconds when the request was created.
criteria
localOnly
Returns
A new instance of RequestOp representing a "Replace" request.

◆ ToSummaryString()

string Buzzware.Cascade.RequestOp.ToSummaryString ( )
inline

Converts the operation details into a concise summary string for logging or display purposes.

Returns
A string summary of the request operation, including verb, type, id, key, criteria, and freshness.

Be aware that JsonSerializer.Serialize(Criteria) will throw an UnsupportedException in production (not development) if Criteria is an ImmutableDictionary.

◆ UpdateOp< Model >()

RequestOp Buzzware.Cascade.RequestOp.UpdateOp< Model > ( Model model,
IDictionary< string, object?> changes,
long timeMs,
object? criteria = null,
bool? localOnly = null )
inlinestatic

Constructs an "Update" operation for updating an existing model instance with specified changes.

Template Parameters
ModelThe type of the model to be updated.
Parameters
modelThe model instance to be updated.
changesA dictionary containing the changes to be applied to the model.
timeMsThe timestamp in milliseconds when the request was created.
criteria
localOnly
Returns
A new instance of RequestOp representing an "Update" request.

◆ VerbFromString()

RequestVerb Buzzware.Cascade.RequestOp.VerbFromString ( string aString)
inlinestatic

Parses a string to a corresponding RequestVerb. If parsing fails, it returns RequestVerb.None.

Parameters
aStringThe string to be parsed.
Returns
A RequestVerb corresponding to the string, or None if the string could not be parsed.

The documentation for this class was generated from the following file:
  • Buzzware.Cascade/RequestOp.cs