Versioning Examples

These examples show how to use cURL commands for working with versioning.

Enable Versioning on a Cluster

There are three ways to enable versioning at the cluster level:

  • Navigate to Storage UI > Settings > Cluster > policy versioning. Select the checkbox to allow versioning, which is by default disallowed in the cluster.

  • Use the below command where replace ‘password’ with the cluster's admin password.

    swarmctl -C policy.versioning -V allowed -d [node ip] -p "admin:password"
  • Use an SNMP set command, adjusted for the environment. Here, use a different password than the cluster’s admin password.

    snmpset -m +CARINGO-CASTOR-MIB -v2c -M +/usr/share/snmp/mib2c-data -c<snmp r/w community password> -OQs {cluster} clusterConfig.policyVersioning s "allowed"

Enable Versioning on a Domain

Set the Policy-Versioning header to enable versioning for an existing domain:

Enable versioning on an existing domain via Swarm
# curl -i --location-trusted -X PUT --data-binary '' -H "Policy-Versioning: enabled" "$NODEIP?domain=sample&preserve" HTTP/1.1 201 Created Castor-System-Cluster: [cluster] Location: http://192.168.203.190:80/?domain=sample Volume: 89d81040b7874fcfa139de754241bf8a Castor-System-Cluster: [cluster] Location: http://192.168.203.174:80/?domain=sample Volume: c561ae012e1ae663986bb0c6b5baa0de Stored-Digest: aaae8a6e741ae71ea7506b0ce42d37ad Last-Modified: Wed, 21 Dec 2022 15:46:18 GMT Content-UUID: 0cfe794730795e60f185ce3d0e81aa1d Entity-MD5: qq6KbnQa5x6nUGsM5C03rQ== Castor-System-Version: 1671637578.023 Etag: "af39faa06369ac30870c3e2b66a3b000" Castor-System-Alias: 0cfe794730795e60f185ce3d0e81aa1d Replica-Count: 2 Date: Wed, 21 Dec 2022 15:46:18 GMT Server: CAStor Cluster/15.0.0 Content-Length: 54 Content-Type: text/html Keep-Alive: timeout=14400 <html><body>New stream version created</body></html>
Enable versioning on an existing domain via Gateway

The rest of the examples will also be via Gateway as a best practice.

Review the headers returned to verify the versioning state for a domain:

Notice Policy-Version-Evaluated is enabled. All tenanted alias objects in the domain are versioned.

Enable Versioning on a Bucket

Verify the versioning state of the bucket:

Notice Policy-Version-Evaluated is also enabled. All named objects in the bucket are versioned.

Create a Named Object in the Bucket

This request has typical headers.

Verify the new object:

List Versions in the Bucket

Elasticsearch must be enabled to use listing operations. 

Tip

Always add &sort=tmborn:DESC,etag:DESC to listing operations to retrieve the versions in the precise order Swarm is maintaining, starting with the current version.

Update the Named Object (Updated Twice, Only Once Shown)

Verify the change to the named object:

View the New Version in the Listing

Read the First Version-Notice the Content

Delete the Prior Version

Deleting that historical version permanently erases it:

List the versions again to verify the deletion:

Delete the Current Version

Deleting the current version adds a delete marker:

Listing the versions shows the addition of a new version, the delete marker:

Notice the delete marker has the same name but is 0 bytes and has "deletemarker":"true".

Check the Delete Marker

Getting INFO on the current version (the delete marker) results in a 404 Not Found error, but provides information about the delete marker:

Note the ETag (version ID) of the delete marker is returned.

© DataCore Software Corporation. · https://www.datacore.com · All rights reserved.