|
| 1 | +--- |
| 2 | +tags: |
| 3 | + - Community |
| 4 | + - Enterprise |
| 5 | +displayed_sidebar: docsEnglish |
| 6 | +--- |
| 7 | + |
| 8 | +# ScalarDL HashStore Command Reference |
| 9 | + |
| 10 | +This page introduces `scalardl-hashstore`, which is a client command for interacting with ScalarDL HashStore. |
| 11 | + |
| 12 | +## Overview of commands |
| 13 | + |
| 14 | +- **Bootstrap HashStore** |
| 15 | + - [`bootstrap`](#bootstrap): Bootstrap by registering identity and predefined contracts required to use HashStore. |
| 16 | +- **Manage objects** |
| 17 | + - [`get-object`](#get-object): Get an object from HashStore. |
| 18 | + - [`put-object`](#put-object): Put an object to HashStore. |
| 19 | + - [`compare-object-versions`](#compare-object-versions): Compare object versions. |
| 20 | +- **Manage collections** |
| 21 | + - [`create-collection`](#create-collection): Create a new collection. |
| 22 | + - [`get-collection`](#get-collection): Get a collection from HashStore. |
| 23 | + - [`add-to-collection`](#add-to-collection): Add objects to a collection. |
| 24 | + - [`remove-from-collection`](#remove-from-collection): Remove objects from a collection. |
| 25 | + - [`get-collection-history`](#get-collection-history): Get the history of a collection. |
| 26 | +- **Validate the ledger** |
| 27 | + - [`validate-ledger`](#validate-ledger): Validate a specified object or collection in HashStore. |
| 28 | + |
| 29 | +## `bootstrap` |
| 30 | + |
| 31 | +Bootstrap by registering identity and predefined contracts required to use HashStore. |
| 32 | + |
| 33 | +### Options |
| 34 | + |
| 35 | +| Option | Description | |
| 36 | +|:---------------------------|:-------------------------------------------| |
| 37 | +| `--config`, `--properties` | A configuration file in the .properties format. | |
| 38 | + |
| 39 | +[Common utility options](#common-utility-options) are also available. |
| 40 | + |
| 41 | +### Examples |
| 42 | + |
| 43 | +```console |
| 44 | +scalardl-hashstore bootstrap --properties client.properties |
| 45 | +``` |
| 46 | + |
| 47 | +## `get-object` |
| 48 | + |
| 49 | +Get an object from HashStore. |
| 50 | + |
| 51 | +### Options |
| 52 | + |
| 53 | +| Option | Description | |
| 54 | +|:---------------------------|:-------------------------------------------| |
| 55 | +| `--config`, `--properties` | A configuration file in the .properties format. | |
| 56 | +| `--object-id` | The ID of the object to retrieve. | |
| 57 | + |
| 58 | +[Common utility options](#common-utility-options) are also available. |
| 59 | + |
| 60 | +### Examples |
| 61 | + |
| 62 | +```console |
| 63 | +scalardl-hashstore get-object --properties client.properties --object-id foo |
| 64 | +``` |
| 65 | + |
| 66 | +## `put-object` |
| 67 | + |
| 68 | +Put an object to HashStore. |
| 69 | + |
| 70 | +### Options |
| 71 | + |
| 72 | +| Option | Description | |
| 73 | +|:---------------------------|:------------------------------------------------------------| |
| 74 | +| `--config`, `--properties` | A configuration file in the .properties format. | |
| 75 | +| `--object-id` | The ID of the object to store. | |
| 76 | +| `--hash` | The hash value of the object. | |
| 77 | +| `--metadata` | Optional metadata as a JSON string. | |
| 78 | +| `--put-to-mutable` | Optional Put operation for a mutable database as a JSON string. | |
| 79 | + |
| 80 | +[Common utility options](#common-utility-options) are also available. |
| 81 | + |
| 82 | +### Examples |
| 83 | + |
| 84 | +Put an object with a hash value. |
| 85 | + |
| 86 | +```console |
| 87 | +scalardl-hashstore put-object --properties client.properties --object-id foo --hash b97a42c87a46ffebe1439f8c1cd2f86e2f9b84dad89c8e9ebb257a19b6fdfe1c |
| 88 | +``` |
| 89 | + |
| 90 | +Put an object with metadata. |
| 91 | + |
| 92 | +```console |
| 93 | +scalardl-hashstore put-object --properties client.properties --object-id foo --hash b97a42c87a46ffebe1439f8c1cd2f86e2f9b84dad89c8e9ebb257a19b6fdfe1c --metadata '{"note": "updated"}' |
| 94 | +``` |
| 95 | + |
| 96 | +## `compare-object-versions` |
| 97 | + |
| 98 | +Compare object versions. |
| 99 | + |
| 100 | +### Options |
| 101 | + |
| 102 | +| Option | Description | |
| 103 | +|:---------------------------|:--------------------------------------------------------------| |
| 104 | +| `--config`, `--properties` | A configuration file in the .properties format. | |
| 105 | +| `--object-id` | The ID of the object to compare versions. | |
| 106 | +| `--versions` | Object versions to compare as a JSON array. | |
| 107 | +| `--all` | Compare all versions including stored versions in the ledger. | |
| 108 | +| `--verbose` | Show detailed validation information. | |
| 109 | + |
| 110 | +[Common utility options](#common-utility-options) are also available. |
| 111 | + |
| 112 | +### Examples |
| 113 | + |
| 114 | +Compare the latest versions specified in the arguments. |
| 115 | + |
| 116 | +```console |
| 117 | +scalardl-hashstore compare-object-versions --properties client.properties --object-id foo --versions '[{"version_id": "v1", "hash_value": "hash1"}, {"version_id": "v2", "hash_value": "hash2", "metadata": {"note": "updated"}}]' |
| 118 | +``` |
| 119 | + |
| 120 | +Compare all versions stored in HashStore. |
| 121 | + |
| 122 | +```console |
| 123 | +scalardl-hashstore compare-object-versions --properties client.properties --object-id foo --versions '[{"version_id": "v1", "hash_value": "hash1"}, {"version_id": "v2", "hash_value": "hash2", "metadata": {"note": "updated"}}]' --all |
| 124 | +``` |
| 125 | + |
| 126 | +Compare with the verbose output. |
| 127 | + |
| 128 | +```console |
| 129 | +scalardl-hashstore compare-object-versions --properties client.properties --object-id foo --versions '[{"version_id": "v1", "hash_value": "hash1"}]' --verbose |
| 130 | +``` |
| 131 | + |
| 132 | +## `create-collection` |
| 133 | + |
| 134 | +Create a new collection. |
| 135 | + |
| 136 | +### Options |
| 137 | + |
| 138 | +| Option | Description | |
| 139 | +|:---------------------------|:-------------------------------------------| |
| 140 | +| `--config`, `--properties` | A configuration file in the .properties format. | |
| 141 | +| `--collection-id` | The ID of the collection to create. | |
| 142 | +| `--object-ids` | Object IDs to include in the collection. | |
| 143 | + |
| 144 | +[Common utility options](#common-utility-options) are also available. |
| 145 | + |
| 146 | +### Examples |
| 147 | + |
| 148 | +Create an empty collection. |
| 149 | + |
| 150 | +```console |
| 151 | +scalardl-hashstore create-collection --properties client.properties --collection-id audit_set |
| 152 | +``` |
| 153 | + |
| 154 | +Create a collection with initial objects. |
| 155 | + |
| 156 | +```console |
| 157 | +scalardl-hashstore create-collection --properties client.properties --collection-id audit_set --object-ids object1 --object-ids object2 |
| 158 | +``` |
| 159 | + |
| 160 | +## `get-collection` |
| 161 | + |
| 162 | +Get a collection from HashStore. |
| 163 | + |
| 164 | +### Options |
| 165 | + |
| 166 | +| Option | Description | |
| 167 | +|:---------------------------|:-------------------------------------------| |
| 168 | +| `--config`, `--properties` | A configuration file in the .properties format. | |
| 169 | +| `--collection-id` | The ID of the collection to retrieve. | |
| 170 | + |
| 171 | +[Common utility options](#common-utility-options) are also available. |
| 172 | + |
| 173 | +### Examples |
| 174 | + |
| 175 | +```console |
| 176 | +scalardl-hashstore get-collection --properties client.properties --collection-id audit_set |
| 177 | +``` |
| 178 | + |
| 179 | +## `add-to-collection` |
| 180 | + |
| 181 | +Add objects to a collection. |
| 182 | + |
| 183 | +### Options |
| 184 | + |
| 185 | +| Option | Description | |
| 186 | +|:---------------------------|:--------------------------------------------------------------------| |
| 187 | +| `--config`, `--properties` | A configuration file in the .properties format. | |
| 188 | +| `--collection-id` | The ID of the collection. | |
| 189 | +| `--object-ids` | Object IDs to add to the collection. | |
| 190 | +| `--force` | Skip validation for duplicate object IDs already in the collection. | |
| 191 | + |
| 192 | +[Common utility options](#common-utility-options) are also available. |
| 193 | + |
| 194 | +### Examples |
| 195 | + |
| 196 | +Add objects to a collection. |
| 197 | + |
| 198 | +```console |
| 199 | +scalardl-hashstore add-to-collection --properties client.properties --collection-id audit_set --object-ids object3 --object-ids object4 |
| 200 | +``` |
| 201 | + |
| 202 | +Add an object with the force flag. |
| 203 | + |
| 204 | +```console |
| 205 | +scalardl-hashstore add-to-collection --properties client.properties --collection-id audit_set --object-ids object3 --force |
| 206 | +``` |
| 207 | + |
| 208 | +## `remove-from-collection` |
| 209 | + |
| 210 | +Remove objects from a collection. |
| 211 | + |
| 212 | +### Options |
| 213 | + |
| 214 | +| Option | Description | |
| 215 | +|:---------------------------|:---------------------------------------------------------------| |
| 216 | +| `--config`, `--properties` | A configuration file in the .properties format. | |
| 217 | +| `--collection-id` | The ID of the collection. | |
| 218 | +| `--object-ids` | Object IDs to remove from the collection. | |
| 219 | +| `--force` | Skip validation for object IDs that are not in the collection. | |
| 220 | + |
| 221 | +[Common utility options](#common-utility-options) are also available. |
| 222 | + |
| 223 | +### Examples |
| 224 | + |
| 225 | +Remove objects from a collection. |
| 226 | + |
| 227 | +```console |
| 228 | +scalardl-hashstore remove-from-collection --properties client.properties --collection-id audit_set --object-ids object1 --object-ids object2 |
| 229 | +``` |
| 230 | + |
| 231 | +Remove an object with the force flag. |
| 232 | + |
| 233 | +```console |
| 234 | +scalardl-hashstore remove-from-collection --properties client.properties --collection-id audit_set --object-ids object1 --force |
| 235 | +``` |
| 236 | + |
| 237 | +## `get-collection-history` |
| 238 | + |
| 239 | +Get the history of a collection. |
| 240 | + |
| 241 | +### Options |
| 242 | + |
| 243 | +| Option | Description | |
| 244 | +|:---------------------------|:----------------------------------------------------| |
| 245 | +| `--config`, `--properties` | A configuration file in the .properties format. | |
| 246 | +| `--collection-id` | The ID of the collection. | |
| 247 | +| `--limit` | Maximum number of recent history entries to return. | |
| 248 | + |
| 249 | +[Common utility options](#common-utility-options) are also available. |
| 250 | + |
| 251 | +### Examples |
| 252 | + |
| 253 | +Get all histories of a collection. |
| 254 | + |
| 255 | +```console |
| 256 | +scalardl-hashstore get-collection-history --properties client.properties --collection-id audit_set |
| 257 | +``` |
| 258 | + |
| 259 | +Get the limited history of a collection. |
| 260 | + |
| 261 | +```console |
| 262 | +scalardl-hashstore get-collection-history --properties client.properties --collection-id audit_set --limit 10 |
| 263 | +``` |
| 264 | + |
| 265 | +## `validate-ledger` |
| 266 | + |
| 267 | +Validate a specified object or collection in HashStore. |
| 268 | + |
| 269 | +### Options |
| 270 | + |
| 271 | +| Option | Description | |
| 272 | +|:---------------------------|:-------------------------------------------| |
| 273 | +| `--config`, `--properties` | A configuration file in the .properties format. | |
| 274 | +| `--object-id` | The ID of the object to validate. | |
| 275 | +| `--collection-id` | The ID of the collection to validate. | |
| 276 | +| `--start-age` | The start age for validation range. | |
| 277 | +| `--end-age` | The end age for validation range. | |
| 278 | + |
| 279 | +[Common utility options](#common-utility-options) are also available. |
| 280 | + |
| 281 | +### Examples |
| 282 | + |
| 283 | +Validate an object for all ages. |
| 284 | + |
| 285 | +```console |
| 286 | +scalardl-hashstore validate-ledger --properties client.properties --object-id foo |
| 287 | +``` |
| 288 | + |
| 289 | +Validate an object from age 0 to age 10 only. |
| 290 | + |
| 291 | +```console |
| 292 | +scalardl-hashstore validate-ledger --properties client.properties --object-id foo --start-age 0 --end-age 10 |
| 293 | +``` |
| 294 | + |
| 295 | +Validate a collection for all ages. |
| 296 | + |
| 297 | +```console |
| 298 | +scalardl-hashstore validate-ledger --properties client.properties --collection-id audit_set |
| 299 | +``` |
| 300 | + |
| 301 | +Validate a collection from age 0 to age 5 only. |
| 302 | + |
| 303 | +```console |
| 304 | +scalardl-hashstore validate-ledger --properties client.properties --collection-id audit_set --start-age 0 --end-age 5 |
| 305 | +``` |
| 306 | + |
| 307 | +## Common utility options |
| 308 | + |
| 309 | +You can use the following options in all the commands above. |
| 310 | + |
| 311 | +| Option | Description | |
| 312 | +|:----------------------|:--------------------------------------------| |
| 313 | +| `-g`, `--use-gateway` | A flag to use the gateway. | |
| 314 | +| `-h`, `--help` | Display the help message of a command. | |
| 315 | +| `--stacktrace` | Output the Java stack trace to the `stderr` stream. | |
0 commit comments