Skip to main content

Clear-ZrStore

Removes every item from the connected Zaris store and reports how many were deleted. This is destructive and irreversible, so it prompts for confirmation unless -Force is supplied.

Syntax

Clear-ZrStore [-Force]
[-ConnectionString <string>] [-StoreName <string>] [-Endpoints <string[]>] [-TimeoutSec <int>]
[-WhatIf] [-Confirm]

Description

Clear-ZrStore deletes all items held in the connected store. It requires an active connection opened with Connect-ZrStore, or the independent -StoreName/-Endpoints parameters for a one-shot connection.

As the data is dropped, the owning nodes release their memory, so the store's footprint falls back toward its fixed per-segment structural baseline. Because the operation cannot be undone, the cmdlet is declared with a high confirm impact and supports ShouldProcess: it prompts for confirmation unless you pass -Force (or -Confirm:$false). Press Ctrl+C to cancel safely.

On success the returned object has StoreName, Cleared ($true), DeletedCount, Success ($true), and Error ($null). If the operation fails, it returns StoreName, Cleared ($false), Success ($false), Status, and Error.

Parameters

ParameterTypeRequiredDescription
-ForceSwitchParameterNoClears the store without prompting for confirmation. Equivalent to -Confirm:$false.
-ConnectionStringStringNoConnect via a Zaris connection string, e.g. zaris://host:7861/store; an alternative to -StoreName + -Endpoints for a one-shot connection. Ignored when a Connect-ZrStore session is active.
-StoreNameStringNoStore to operate on for a one-shot (independent) connection instead of the active session. Requires -Endpoints; ignored when a Connect-ZrStore session is active.
-EndpointsString[]NoOne or more host:port endpoints for a one-shot connection. Ignored when a session is active.
-TimeoutSecInt32NoConnection timeout in seconds for a one-shot connection. Range 1–120. Default 5.

Supports the -WhatIf and -Confirm common parameters via ShouldProcess.

Examples

Clear the connected store, prompting for confirmation first:

Clear-ZrStore

Clear the store without prompting:

Clear-ZrStore -Force

Preview the operation without deleting anything:

Clear-ZrStore -WhatIf

Clear a store over a one-shot connection:

Clear-ZrStore -ConnectionString "zaris://node1:7861/orders" -Force