Skip to content

Containers and state ​

WgsContainer ​

csharp
public sealed class WgsContainer

One logical container in a wgs folder. All members are settable, but treat the collection from WgsStore.Containers as owned by the store and change containers only through store methods.

PropertyTypeDescription
NamestringThe container name, for example ForScience-WC.
Name2stringThe second name field; the same as Name in practice.
EtagstringService-issued version token. Echoed back untouched on every local write. Empty when never uploaded.
ContainerNumberbyteThe N in container.N. Advances on each write and wraps at 255.
StateWgsEntryStateHow the container stands against its cloud copy. An undefined raw value reads as Modified here.
RawStateuintThe state as read, so an undefined value can be reported and repaired.
HasInvalidStateboolRawState is greater than Created (5).
IsPendingDeletionboolA well-formed tombstone: state Deleted (3) with the ETag the cloud issued.
StateContradictsEtagboolBit 2 of the state ("never uploaded") must be set if and only if the ETag is empty; true when it is not.
FolderGuidGuidThe GUID folder holding the manifest and blob.
FileTimelongEntry FILETIME, millisecond granular.
ReservedlongRound-tripped verbatim.
BlobSizelongBlob size in bytes. Must equal the real blob byte count.
FolderNamestringFolderGuid as 32 upper-case hex digits (the folder name).

WgsEntryState ​

csharp
public enum WgsEntryState : uint
MemberValueMeaning
UnknownZero0Undefined.
Synced1Local and cloud agree; the resting state.
Modified2Changed locally since the last sync; keeps its ETag.
Deleted3A tombstone kept so the deletion can reach the cloud.
UnknownFour4Undefined.
Created5Made locally and never uploaded; the ETag is empty.

The mapping follows libNOM.io. See the format reference for the discussion of where public documentation disagrees.

WgsSyncState ​

csharp
[Flags] public enum WgsSyncState : uint
MemberValueMeaning
None0
FullyUploaded1Cleared by every write.
FullyDownloaded2
HasUnresolvedConflicts16Never cleared locally. Blocks writes under the default gate.

WgsOrphanedContainer ​

csharp
public sealed record WgsOrphanedContainer(
    string FolderName, string FolderPath, byte ContainerNumber, Guid BlobId,
    long BlobSize, DateTime LastWrittenUtc, string? Label, string? SuggestedContainerName);

Save data in a wgs folder that no index entry points at. Label and SuggestedContainerName come from the IWgsBlobInspector, if one was supplied.

WgsManifestInfo ​

csharp
public sealed record WgsManifestInfo(Guid Current, Guid Previous, uint BlobCount);

Both blob ids a container.N manifest records (the file on disk and the one the cloud last knew), and how many blob entries it declares. It describes the first blob of a manifest; the full list is WgsBlobEntry.

WgsBlobEntry ​

csharp
public sealed record WgsBlobEntry(string Name, Guid CloudId, Guid LocalId);

One blob entry of a container.N manifest: a name (a 128-byte UTF-16 field) and two GUIDs. CloudId is the blob id as the cloud last knew it, LocalId the file on disk; they differ only while a sync is in flight.

WgsBlobInfo ​

csharp
public sealed record WgsBlobInfo(string Name, Guid CloudId, Guid LocalId, long? Size)
{
    public bool SyncInFlight { get; }   // CloudId != LocalId
}

What TryListBlobs reports. Size is the on-disk size, or null when the file is missing.

WgsDeleteAction and WgsDeletePlan ​

csharp
public enum WgsDeleteAction { RemoveFromIndex, MarkDeleted, AlreadyDeleted }
public sealed record WgsDeletePlan(string ContainerName, WgsDeleteAction Action,
    IReadOnlyList<string> Steps, WgsWriteAssessment Assessment);

Export and import types ​

csharp
public sealed record WgsExportBlob(string Name, string File, long Size, string Sha256);
public sealed record WgsExportContainer(string Name, WgsEntryState State, string Etag,
    byte ContainerNumber, IReadOnlyList<WgsExportBlob> Blobs);
public sealed record WgsExportManifest(string Format, int Version, string PackageFamilyName,
    IReadOnlyList<WgsExportContainer> Containers);
public sealed record WgsImportItem(string ContainerName, bool IsNew, IReadOnlyList<string> BlobNames, long TotalBytes);
public sealed record WgsImportPlan(IReadOnlyList<WgsImportItem> Items, IReadOnlyList<string> Problems,
    WgsWriteAssessment Assessment)
{
    public bool CanApply { get; }   // no problems, something to import, and the gate allows it
}

Released under the Apache-2.0 license. Not affiliated with Microsoft.