Skip to main content

ArchiveCopyStagingLocation

Namespace: Meshmakers.Octo.Runtime.Contracts.StreamData

Where the files of a native archive copy lie, as the CrateDB nodes see them: the location URI of the COPY … TO DIRECTORY / COPY … FROM statement plus the WITH options that carry the credential (protocol, sas_token, key). Built by the host (octo-common-services) from the artifact store settings; consumed by IStreamDataRepository.CopyToStagingAsync(OctoObjectId, ArchiveCopyPlan, ArchiveCopyStagingLocation, ArchiveCopyOptions, CancellationToken) and IStreamDataRepository.CopyFromStagingAsync(OctoObjectId, ArchiveCopyPlan, ArchiveCopyStagingLocation, ArchiveCopyOptions, CancellationToken).

public sealed class ArchiveCopyStagingLocation

Inheritance Object → ArchiveCopyStagingLocation

Remarks:

The endpoint in ArchiveCopyStagingLocation.RevealUri() is the one CrateDB uses. It can differ from the endpoint the bot reaches the same store with (local development: the cluster name and port for CrateDB, the host port for the bot), so this type is deliberately not the bot's artifact store configuration.

The credential cannot leak through this type by accident. The URI and the options are only reachable through the methods ArchiveCopyStagingLocation.RevealUri() and ArchiveCopyStagingLocation.RevealOptions(); every property, ArchiveCopyStagingLocation.ToString() and with it string interpolation, exception messages, structured logging and any reflection-based serializer show the redacted form (ArchiveCopyRedaction). Callers that build a statement call the two Reveal… methods and keep the result out of every log, exception and trace. ArchiveCopyStagingLocation.Scrub(String) removes the credential from a text that may echo it, such as a driver error message.

Properties​

Scheme​

The URI scheme in lower case, e.g. s3, az or file.

public string Scheme { get; }

Property Value​

String

RedactedUri​

The location without credential (ArchiveCopyRedaction.RedactUri(String)).

public string RedactedUri { get; }

Property Value​

String

RedactedOptions​

The WITH options with every value masked that is not known to be free of secrets.

public IReadOnlyDictionary<string, string> RedactedOptions { get; }

Property Value​

IReadOnlyDictionary<String, String>

Constructors​

ArchiveCopyStagingLocation(String, IEnumerable<KeyValuePair<String, String>>)​

public ArchiveCopyStagingLocation(string crateUri, IEnumerable<KeyValuePair<string, string>> withOptions)

Parameters​

crateUri String
The location as CrateDB sees it, e.g. s3://key:secret@minio.octo-infra:9000/bucket/prefix or az://account.blob.core.windows.net/container/prefix. May contain the credential (S3 key pair).

withOptions IEnumerable<KeyValuePair<String, String>>
The WITH options of the statement that belong to the location, e.g. protocol=http or sas_token=…. Option names are case-insensitive.

Exceptions​

ArgumentException
The URI has no scheme or an option has no name or no value. The message never contains the input.

Methods​

RevealUri()​

The location exactly as the statement needs it — may contain the credential. Use it to build the statement only; never log it, put it into an exception or hand it to tracing.

public string RevealUri()

Returns​

String

RevealOptions()​

The WITH options exactly as the statement needs them — may contain the credential (sas_token, key). Same rules as ArchiveCopyStagingLocation.RevealUri().

public IReadOnlyDictionary<string, string> RevealOptions()

Returns​

IReadOnlyDictionary<String, String>

WithSubPath(String)​

The location of one sub-directory, e.g. <rtId>/data/<slice> (ArchiveCopySlice.GetStagingPath(OctoObjectId)). The options stay.

public ArchiveCopyStagingLocation WithSubPath(string relativePath)

Parameters​

relativePath String

Returns​

ArchiveCopyStagingLocation

Exceptions​

ArgumentException
The path is empty or has an empty, . or .. segment or a backslash.

Scrub(String)​

Replaces every part of the credential that occurs in text — user info of the URI, its key and secret, the values of all options not known to be free of secrets — with ArchiveCopyRedaction.Mask. For texts that may echo the statement, such as the message of a driver exception. The longest value is replaced first.

public string Scrub(string text)

Parameters​

text String

Returns​

String

ToString()​

The redacted location and options, e.g. s3://***@host:9000/bucket/p [key=***, protocol=http].

public string ToString()

Returns​

String