├── .gitignore ├── README.md ├── examples ├── platform │ └── simple-streaming-pipeline │ │ ├── Makefile │ │ ├── README.md │ │ ├── build.gradle │ │ ├── settings.gradle │ │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── example │ │ └── SimplePipeline.java ├── serialization │ ├── classroom.yaml │ ├── school.yaml │ └── student.yaml └── sql │ └── dessert.sql ├── extras └── unix │ └── install.sh └── scripts ├── map_sizes.star └── serialization_report.star /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vscode/ 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hazelcast CLC 2 | 3 | Hazelcast CLC is a command line tool that enables developers to use Hazelcast data structures, run SQL queries, scaffold projects, manage Viridian clusters and more. 4 | 5 | Apart from this README, this repository contains: 6 | * [Examples](https://github.com/hazelcast/hazelcast-commandline-client/blob/main/examples) to get you started with various features of CLC. 7 | * Some useful [Advanced Scripts](https://github.com/hazelcast/hazelcast-commandline-client/blob/main/scripts). 8 | 9 | ## Documentation 10 | 11 | Our documentation is hosted at: https://docs.hazelcast.com/clc/latest/overview. 12 | 13 | ## Installation 14 | 15 | ### Linux / macOS 16 | 17 | We provide an easy to use install script for the following platforms: 18 | * Linux/amd64 19 | * Linux/arm64 20 | * Linux/arm 21 | * macOS/amd64 (Intel) 22 | * macOS/arm64 (M1, M2, ...) 23 | 24 | You can install the latest GA version of CLC using: 25 | ``` 26 | curl https://hazelcast.com/clc/install.sh | bash 27 | ``` 28 | You can install the latest BETA or preview version using: 29 | ``` 30 | curl https://hazelcast.com/clc/install.sh | bash -s -- --beta 31 | ``` 32 | 33 | ### Windows 34 | 35 | You can download an installer for amd64 / Intel from https://github.com/hazelcast/hazelcast-commandline-client/releases/latest. 36 | The installer is named `hazelcast-clc-setup_VERSION_amd64.exe` 37 | 38 | The installer can install CLC either system-wide or just for the user. 39 | It adds the `clc` binary automatically to the `$PATH`, so it can be run in any terminal without additional settings. 40 | 41 | ### Manual Download 42 | 43 | You can download CLC manually from our [Releases](https://github.com/hazelcast/hazelcast-commandline-client/releases) page. 44 | The latest GA release is always at: https://github.com/hazelcast/hazelcast-commandline-client/releases/latest. 45 | 46 | On macOS, binaries downloaded outside of AppStore require your intervention to run. 47 | The install script automatically handles this, but if you downloaded a release package you can do it manually: 48 | ``` 49 | $ xattr -d com.apple.quarantine CLC_FOLDER/clc 50 | ``` 51 | Use the correct path instead of `CLC_FOLDER` in the command above. 52 | 53 | ### Building from Source 54 | 55 | The latest open source release of CLC is v5.3.3 and it can be cloned from: 56 | https://github.com/hazelcast/hazelcast-commandline-client/tree/v5.3.3 57 | 58 | CLC v5.3.4 and up are binary only releases. 59 | You can find all our relases at: 60 | https://github.com/hazelcast/hazelcast-commandline-client/releases. 61 | 62 | ## Help 63 | 64 | * Join our Slack channel: https://hazelcastcommunity.slack.com/channels/clc. You can get an invite at: https://slack.hazelcast.com/ 65 | * Check out this link for our Enterprise support: https://hazelcast.com/services/support/ 66 | 67 | ## Other Resources 68 | 69 | * [Introducing CLC: The New Hazelcast Command-Line Experience](https://hazelcast.com/blog/introducing-clc-the-new-hazelcast-command-line-experience/) [Blog article] 70 | * [The New Hazelcast Command-Line Experience](https://www.youtube.com/watch?v=lIj7jEV-jp4) [Video] 71 | * [Creating and Managing Real-Time Kafka Pipelines with Hazelcast CLC](https://www.youtube.com/watch?v=Q_9Y9yQBzIY) [Video] 72 | -------------------------------------------------------------------------------- /examples/platform/simple-streaming-pipeline/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: build 2 | 3 | build: 4 | ./gradlew shadowJar 5 | -------------------------------------------------------------------------------- /examples/platform/simple-streaming-pipeline/README.md: -------------------------------------------------------------------------------- 1 | # Simple Streaming Pipeline 2 | 3 | Requirements: 4 | 5 | 1. JRE 8 6 | 2. Gradle 8 7 | 8 | ## Usage 9 | 10 | ### Compile the project 11 | 12 | ``` 13 | gradle shadowJar 14 | ``` 15 | 16 | ### Submit the Jet Job 17 | 18 | ``` 19 | clc job submit --name my-pipeline ./build/libs/simple-streaming-pipeline-1.0-SNAPSHOT-all.jar 20 | ``` 21 | 22 | ### Observe the Map Updates 23 | 24 | ``` 25 | clc map -n my-map entry-set 26 | ``` 27 | 28 | ### Clean Up 29 | 30 | ``` 31 | clc job cancel --my-pipeline 32 | ``` 33 | -------------------------------------------------------------------------------- /examples/platform/simple-streaming-pipeline/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | id 'com.github.johnrengelman.shadow' version '7.1.2' 4 | } 5 | 6 | group = 'org.example' 7 | version = '1.0-SNAPSHOT' 8 | 9 | repositories { 10 | mavenCentral() 11 | } 12 | 13 | dependencies { 14 | compileOnly 'com.hazelcast:hazelcast:5.3.0-BETA-2' 15 | implementation 'org.hashids:hashids:1.0.3' 16 | testImplementation platform('org.junit:junit-bom:5.9.1') 17 | testImplementation 'org.junit.jupiter:junit-jupiter' 18 | } 19 | 20 | test { 21 | useJUnitPlatform() 22 | } 23 | 24 | jar.manifest.attributes 'Main-Class': 'com.example.SimplePipeline' 25 | 26 | compileJava { 27 | sourceCompatibility = '1.8' 28 | targetCompatibility = '1.8' 29 | } 30 | -------------------------------------------------------------------------------- /examples/platform/simple-streaming-pipeline/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'simple-streaming-pipeline' 2 | 3 | -------------------------------------------------------------------------------- /examples/platform/simple-streaming-pipeline/src/main/java/com/example/SimplePipeline.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import com.hazelcast.core.Hazelcast; 4 | import com.hazelcast.core.HazelcastInstance; 5 | import com.hazelcast.jet.config.JetConfig; 6 | import com.hazelcast.jet.config.JobConfig; 7 | import com.hazelcast.jet.pipeline.Pipeline; 8 | import com.hazelcast.jet.pipeline.Sinks; 9 | import com.hazelcast.jet.pipeline.test.TestSources; 10 | import org.hashids.Hashids; 11 | 12 | import java.util.AbstractMap; 13 | 14 | public class SimplePipeline { 15 | public static void main(String[] args) { 16 | final String mapName = (args.length > 0)? args[0] : "my-map"; 17 | // Create a pipeline that creates one item per second 18 | // and writes it to a map with the name given as an argument or my-map. 19 | Pipeline pipeline = Pipeline.create(); 20 | pipeline.readFrom(TestSources.itemStream(1)) 21 | .withoutTimestamps() 22 | .map(e -> new AbstractMap.SimpleEntry<>( 23 | e.sequence(), 24 | new Hashids().encode(e.sequence())) 25 | ) 26 | .writeTo(Sinks.map(mapName, 27 | // Map key is the sequence number 28 | AbstractMap.SimpleEntry::getKey, 29 | // Map value is the hash ID of the sequence 30 | AbstractMap.SimpleEntry::getValue)); 31 | HazelcastInstance hz = Hazelcast.bootstrappedInstance(); 32 | JobConfig config = new JobConfig(); 33 | // optionally set the name of the job 34 | config.setName("simple-pipeline"); 35 | hz.getJet().newJob(pipeline, config); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /examples/serialization/classroom.yaml: -------------------------------------------------------------------------------- 1 | namespace: "org.foo" 2 | imports: 3 | - student.yaml 4 | classes: 5 | - name: Classroom 6 | fields: 7 | - name: id 8 | type: int32 9 | - name: students 10 | type: org.bar.Student[] 11 | -------------------------------------------------------------------------------- /examples/serialization/school.yaml: -------------------------------------------------------------------------------- 1 | namespace: "org.example" 2 | imports: 3 | - classroom.yaml 4 | classes: 5 | - name: School 6 | fields: 7 | - name: id 8 | type: int32 9 | - name: classrooms 10 | type: org.foo.Classroom[] 11 | -------------------------------------------------------------------------------- /examples/serialization/student.yaml: -------------------------------------------------------------------------------- 1 | namespace: "org.bar" 2 | classes: 3 | - name: Student 4 | fields: 5 | - name: id 6 | type: int32 7 | - name: name 8 | type: string 9 | - name: enrolledLessons 10 | type: "[]Lesson" 11 | external: true -------------------------------------------------------------------------------- /examples/sql/dessert.sql: -------------------------------------------------------------------------------- 1 | -- (c) 2023, Hazelcast, Inc. All Rights Reserved. 2 | 3 | CREATE OR REPLACE MAPPING desserts( 4 | __key int, 5 | name varchar, 6 | category varchar 7 | ) TYPE IMAP OPTIONS ( 8 | 'keyFormat' = 'int', 9 | 'valueFormat' = 'json-flat' 10 | ); 11 | 12 | CREATE OR REPLACE MAPPING orders( 13 | __key int, 14 | dessertId int, 15 | itemCount int, 16 | dessertName varchar, 17 | dessertCategory varchar 18 | ) TYPE IMAP OPTIONS ( 19 | 'keyFormat' = 'int', 20 | 'valueFormat' = 'json-flat' 21 | ); 22 | 23 | SINK INTO desserts (__key, name, category) VALUES 24 | (0, 'Bolo de Bolacha', 'Cakes'), 25 | (1, 'Tiramisu', 'Cakes'), 26 | (2, 'Cheesecake', 'Cakes'), 27 | (3, 'Black Forest Cake', 'Cakes'), 28 | (4, 'Red Velvet Cake', 'Cakes'), 29 | (5, 'Victoria Sponge Cake', 'Cakes'), 30 | (6, 'Éclair', 'Pastries'), 31 | (7, 'Croissant', 'Pastries'), 32 | (8, 'Baklava', 'Pastries'), 33 | (9, 'Napoleon', 'Pastries'), 34 | (10, 'Strudel', 'Pastries'), 35 | (11, 'Chocolate Truffles', 'Candies'), 36 | (12, 'Turkish Delight', 'Candies'), 37 | (13, 'Fudge', 'Candies'), 38 | (14, 'Toffee', 'Candies'), 39 | (15, 'Caramel', 'Candies'), 40 | (16, 'Chocolate Chip Cookies', 'Cookies'), 41 | (17, 'Macarons', 'Cookies'), 42 | (18, 'Snickerdoodle', 'Cookies'), 43 | (19, 'Oatmeal Raisin Cookies', 'Cookies'), 44 | (20, 'Shortbread', 'Cookies'), 45 | (21, 'Crème Brûlée', 'Custards'), 46 | (22, 'Flan', 'Custards'), 47 | (23, 'Crème Caramel', 'Custards'), 48 | (24, 'Baked Custard', 'Custards'), 49 | (25, 'Panna Cotta', 'Custards'), 50 | (26, 'Churros', 'Fried Desserts'), 51 | (27, 'Funnel Cake', 'Fried Desserts'), 52 | (28, 'Beignets', 'Fried Desserts'), 53 | (29, 'Gulab Jamun', 'Fried Desserts'), 54 | (30, 'Jalebi', 'Fried Desserts'), 55 | (31, 'Banana Pudding', 'Puddings'), 56 | (32, 'Rice Pudding', 'Puddings'), 57 | (33, 'Bread Pudding', 'Puddings'), 58 | (34, 'Tapioca Pudding', 'Puddings'), 59 | (35, 'Chocolate Pudding', 'Puddings'), 60 | (36, 'Apple Pie', 'Pies and Tarts'), 61 | (37, 'Pecan Pie', 'Pies and Tarts'), 62 | (38, 'Lemon Tart', 'Pies and Tarts'), 63 | (39, 'Key Lime Pie', 'Pies and Tarts'), 64 | (40, 'Blueberry Pie', 'Pies and Tarts'), 65 | (41, 'Gelato', 'Frozen Desserts'), 66 | (42, 'Sorbet', 'Frozen Desserts'), 67 | (43, 'Sherbet', 'Frozen Desserts'), 68 | (44, 'Ice Cream', 'Frozen Desserts'), 69 | (45, 'Semifreddo', 'Frozen Desserts'), 70 | (46, 'Hot Chocolate', 'Hot Beverages'), 71 | (47, 'Mulled Wine', 'Hot Beverages'), 72 | (48, 'Chai Tea', 'Hot Beverages'), 73 | (49, 'Dobos Torte', 'Cakes'), 74 | (50, 'Irish Coffee', 'Hot Beverages'), 75 | (51, 'Sacher Torte', 'Cakes'), 76 | (52, 'Opera Cake', 'Cakes') 77 | ; 78 | -------------------------------------------------------------------------------- /extras/unix/install.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # Hazelcast CLC Install script 4 | # (c) 2023 Hazelcast, Inc. 5 | 6 | DEFAULT_VERSION=v5.4.0 7 | 8 | set -eu -o pipefail 9 | 10 | check_ok () { 11 | local what="$1" 12 | local e=no 13 | which "$what" > /dev/null && e=yes 14 | case "$what" in 15 | awk*) state_awk_ok=$e;; 16 | bash*) state_bash_ok=$e;; 17 | curl*) state_curl_ok=$e;; 18 | tar*) state_tar_ok=$e;; 19 | unzip*) state_unzip_ok=$e;; 20 | wget*) state_wget_ok=$e;; 21 | xattr*) state_xattr_ok=$e;; 22 | zsh*) state_zsh_ok=$e;; 23 | *) log_debug "invalid check: $what" 24 | esac 25 | } 26 | 27 | log_warn () { 28 | echo "WARN $1" 1>&2 29 | } 30 | 31 | log_info () { 32 | echo "INFO $1" 1>&2 33 | } 34 | 35 | log_debug () { 36 | if [[ "${state_debug}" == "yes" ]]; then 37 | echo "DEBUG $1" 1>&2 38 | fi 39 | } 40 | 41 | echo_indent () { 42 | printf " %s\n" "$1" 1>&2 43 | } 44 | 45 | echo_note () { 46 | echo "NOTE $1" 1>&2 47 | } 48 | 49 | echo_ok () { 50 | echo " OK $1" 1>&2 51 | } 52 | 53 | bye () { 54 | if [[ "${1:-}" != "" ]]; then 55 | echo "ERROR $*" 1>&2 56 | fi 57 | exit 1 58 | } 59 | 60 | print_usage () { 61 | echo "This script installs Hazelcast CLC to a user directory." 62 | echo 63 | echo "Usage: $0 [--beta | --debug | --help | --version VERSION ]" 64 | echo 65 | echo " --beta Enable downloading BETA and PREVIEW releases" 66 | echo " --debug Enable DEBUG logging" 67 | echo " --help Show help" 68 | echo " --version VERSION Install a specific version" 69 | echo 70 | exit 0 71 | } 72 | 73 | setup () { 74 | detect_tmpdir 75 | for cmd in $DEPENDENCIES; do 76 | check_ok "$cmd" 77 | done 78 | detect_httpget 79 | } 80 | 81 | detect_tmpdir () { 82 | state_tmp_dir="${TMPDIR:-/tmp}" 83 | } 84 | 85 | do_curl () { 86 | curl -LSs "$1" 87 | } 88 | 89 | do_wget () { 90 | wget -O- "$1" 91 | } 92 | 93 | detect_uncompress () { 94 | local ext=${state_archive_ext} 95 | if [[ "$ext" == "tar.gz" ]]; then 96 | state_uncompress=do_untar 97 | elif [[ "$ext" == "zip" ]]; then 98 | state_uncompress=do_unzip 99 | else 100 | bye "$ext archive is not supported" 101 | fi 102 | } 103 | 104 | do_untar () { 105 | if [[ "$state_tar_ok" != "yes" ]]; then 106 | bye "tar is required for install" 107 | fi 108 | local path="$1" 109 | local base="$2" 110 | tar xf "$path" -C "$base" 111 | } 112 | 113 | do_unzip () { 114 | if [[ "$state_unzip_ok" != "yes" ]]; then 115 | bye "unzip is required for install" 116 | fi 117 | local path="$1" 118 | local base="$2" 119 | unzip -o -q "$path" -d "$base" 120 | } 121 | 122 | install_release () { 123 | # create base 124 | local tmp="${state_tmp_dir}" 125 | local base="$tmp/clc" 126 | mkdir -p "$base" 127 | # uncompress release package 128 | local path="${state_archive_path}" 129 | log_debug "UNCOMPRESS $path => $base" 130 | ${state_uncompress} "$path" "$base" 131 | # move files to their place 132 | base="$base/${state_clc_name}" 133 | local bin="$state_bin_dir/clc" 134 | mv_path "$base/clc" "$bin" 135 | local files="README.txt LICENSE.txt" 136 | for item in $files; do 137 | mv_path "$base/$item" "$CLC_HOME/$item" 138 | done 139 | local scripts 140 | set +e 141 | scripts="$(ls $base/scripts 2> /dev/null)" 142 | set -e 143 | if [[ "$scripts" != "" ]]; then 144 | # move builtin scripts 145 | local scripts_target="$CLC_HOME/scripts/builtin" 146 | mkdir -p "$scripts_target" 147 | for item in $scripts; do 148 | mv_path "$base/scripts/$item" "$scripts_target" 149 | done 150 | printf "Do not edit the scripts in this directory.\nThey may be overwritten by the installer.\n" > "$scripts_target/README.txt" 151 | log_info "Copied the scripts to $scripts_target" 152 | fi 153 | # on MacOS remove the clc binary from quarantine 154 | if [[ "$state_xattr_ok" == "yes" && "$state_os" == "darwin" ]]; then 155 | set +e 156 | remove_from_quarantine "$bin" 157 | set -e 158 | fi 159 | } 160 | 161 | remove_from_quarantine () { 162 | local qa 163 | local path 164 | qa="com.apple.quarantine" 165 | path="$1" 166 | for a in $(xattr "$path"); do 167 | if [[ "$a" == "$qa" ]]; then 168 | log_debug "REMOVE FROM QUARANTINE: $path" 169 | xattr -d $qa "$path" 170 | break 171 | fi 172 | done 173 | } 174 | 175 | update_config_files () { 176 | if [[ "$state_bash_ok" == "yes" ]]; then 177 | update_rc "$HOME/.bashrc" 178 | update_rc "$HOME/.profile" 179 | fi 180 | if [[ "$state_zsh_ok" == "yes" ]]; then 181 | update_rc "$HOME/.zshenv" 182 | fi 183 | } 184 | 185 | update_rc () { 186 | local path="$1" 187 | local set_path="PATH=\$PATH:${state_bin_dir}" 188 | local code=" 189 | echo \"\$PATH\" | grep \"${state_bin_dir}\" > /dev/null 190 | if [[ \$? == 1 ]]; then 191 | export $set_path 192 | fi 193 | " 194 | if [[ -e "$path" ]]; then 195 | # check if this file is a symbolic link 196 | if [[ -L "$path" ]]; then 197 | log_warn "$path is a symbolic link. Writing to symbolic links is not supported." 198 | echo_indent "You can manually add the following in $path" 199 | echo_indent "$code" 200 | return 201 | fi 202 | local text 203 | set +e 204 | text=$(cat "$path" | grep "$set_path") 205 | set -e 206 | if [[ "$text" != "" ]]; then 207 | # CLC PATH is already exported in this file 208 | log_debug "CLC PATH is already installed in $path" 209 | return 210 | fi 211 | fi 212 | # Add the CLC PATH to this file 213 | printf '\n# Added by Hazelcast CLC installer' >> "$path" 214 | printf "$code" >> "$path" 215 | log_info "Added CLC path to $path" 216 | } 217 | 218 | mv_path () { 219 | log_debug "MOVE $1 to $2" 220 | mv "$1" "$2" 221 | } 222 | 223 | detect_httpget () { 224 | if [[ "${state_curl_ok}" == "yes" ]]; then 225 | state_httpget=do_curl 226 | elif [[ "${state_wget_ok}" == "yes" ]]; then 227 | state_httpget=do_wget 228 | else 229 | bye "either curl or wget is required" 230 | fi 231 | log_debug "state_httpget=$state_httpget" 232 | } 233 | 234 | httpget () { 235 | log_debug "GET ${state_httpget} $1" 236 | ${state_httpget} "$@" 237 | } 238 | 239 | print_banner () { 240 | local year 241 | year=$(date +%Y) 242 | echo 243 | echo "Hazelcast CLC Installer (c) 2023-$year Hazelcast, Inc." 244 | echo 245 | } 246 | 247 | print_success () { 248 | echo 249 | echo_ok "Hazelcast CLC ${state_download_version} is installed at $CLC_HOME" 250 | echo 251 | echo_indent 'Next steps:' 252 | echo_indent '1. Open a new terminal,' 253 | echo_indent '2. Run `clc version` to confirm that CLC is installed,' 254 | echo_indent '3. Enjoy!' 255 | maybe_print_old_clc_warning 256 | echo 257 | echo_note 'If the steps above do not work, try copying `clc` binary to your $PATH:' 258 | echo_indent "$ sudo cp $state_bin_dir/clc /usr/local/bin" 259 | echo 260 | } 261 | 262 | maybe_print_old_clc_warning () { 263 | # create and assign the variable separately 264 | # so the exit status is not lost 265 | local clc_path 266 | set +e 267 | clc_path=$(which clc) 268 | set -e 269 | local bin_path="$state_bin_dir/clc" 270 | if [[ "$clc_path" != "" && "$clc_path" != "$bin_path" ]]; then 271 | echo 272 | echo_note "A binary named 'clc' already exists at ${clc_path}." 273 | echo_indent 'You may want to delete it before running the installed CLC.' 274 | echo_indent "$ sudo rm -f ${clc_path}" 275 | fi 276 | } 277 | 278 | detect_last_release () { 279 | if [[ "$state_download_version" != "" ]]; then 280 | return 281 | fi 282 | if [[ "$state_awk_ok" != "yes" ]]; then 283 | bye "Awk is required for install" 284 | fi 285 | local re 286 | local text 287 | local v 288 | re='$1 ~ /tag_name/ { gsub(/[",]/, "", $2); print($2) }' 289 | text="$(httpget https://api.github.com/repos/hazelcast/hazelcast-commandline-client/releases)" 290 | if [[ "$state_beta" == "yes" ]]; then 291 | set +e 292 | v=$(echo "$text" | awk "$re" | head -1) 293 | set -e 294 | else 295 | set +e 296 | v=$(echo "$text" | awk "$re" | grep -vi preview | grep -vi beta | head -1) 297 | set -e 298 | fi 299 | if [[ "$v" == "" ]]; then 300 | v=$DEFAULT_VERSION 301 | echo_note "Could not determine the latest version, downloading version $v" 302 | fi 303 | state_download_version="$v" 304 | } 305 | 306 | detect_platform () { 307 | local os 308 | os="$(uname -s)" 309 | case "$os" in 310 | Linux*) os=linux; ext="tar.gz";; 311 | Darwin*) os=darwin; ext="zip";; 312 | *) bye "This script supports only Linux and MacOS, not $os";; 313 | esac 314 | state_os=$os 315 | log_debug "state_os=$state_os" 316 | state_archive_ext=$ext 317 | arch="$(uname -m)" 318 | case "$arch" in 319 | x86_64*) arch=amd64;; 320 | amd64*) arch=amd64;; 321 | armv6l*) arch=arm;; 322 | armv7l*) arch=arm;; 323 | arm64*) arch=arm64;; 324 | aarch64*) arch=arm64;; 325 | *) bye "This script supports only 64bit Intel and 32/64bit ARM architecture, not $arch" 326 | esac 327 | state_arch="$arch" 328 | log_debug "state_arch=$state_arch" 329 | } 330 | 331 | make_download_url () { 332 | local v=${state_download_version} 333 | local clc_name=${state_clc_name} 334 | local ext=${state_archive_ext} 335 | state_download_url="https://github.com/hazelcast/hazelcast-commandline-client/releases/download/$v/${clc_name}.${ext}" 336 | } 337 | 338 | make_clc_name () { 339 | local v="${state_download_version}" 340 | local os="${state_os}" 341 | local arch="${state_arch}" 342 | state_clc_name="hazelcast-clc_${v}_${os}_${arch}" 343 | } 344 | 345 | create_home () { 346 | log_info "Creating the Home directory: $CLC_HOME" 347 | mkdir -p "$state_bin_dir" "$CLC_HOME/etc" 348 | echo "install-script" > "$CLC_HOME/etc/.source" 349 | } 350 | 351 | download_release () { 352 | detect_tmpdir 353 | detect_platform 354 | detect_uncompress 355 | detect_last_release 356 | log_debug "state_download_version=$state_download_version" 357 | make_clc_name 358 | make_download_url 359 | log_info "Downloading: ${state_download_url}" 360 | local tmp 361 | local ext 362 | tmp="${state_tmp_dir}" 363 | ext="${state_archive_ext}" 364 | state_archive_path="$tmp/clc.${ext}" 365 | httpget "${state_download_url}" > "${state_archive_path}" 366 | } 367 | 368 | process_flags () { 369 | local flag="${1:-}" 370 | while [[ "$flag" != "" ]]; do 371 | case "$flag" in 372 | --beta*) state_beta=yes;; 373 | --debug*) state_debug=yes;; 374 | --help*) print_banner; print_usage;; 375 | --version*) 376 | shift 377 | state_download_version=$1 378 | if [[ "$state_download_version" == "" ]]; then 379 | # the version is missing 380 | bye "--version requires a version" 381 | fi 382 | ;; 383 | *) bye "Unknown option: $flag";; 384 | esac 385 | shift 386 | flag="${1:-}" 387 | done 388 | if [[ "$state_download_version" != "" ]]; then 389 | if [[ "$state_beta" == "yes" ]]; then 390 | bye "--beta and --version flags are mutually exclusive" 391 | fi 392 | local first_char=${state_download_version:0:1} 393 | if [[ "$first_char" != "v" ]]; then 394 | state_download_version="v$state_download_version" 395 | fi 396 | fi 397 | } 398 | 399 | DEPENDENCIES="awk bash curl tar unzip wget xattr zsh" 400 | CLC_HOME="${CLC_HOME:-$HOME/.hazelcast}" 401 | 402 | state_arch= 403 | state_archive_ext= 404 | state_archive_path= 405 | state_beta=no 406 | state_bin_dir="$CLC_HOME/bin" 407 | state_clc_name= 408 | state_debug=no 409 | state_download_url= 410 | state_download_version= 411 | state_httpget= 412 | state_os= 413 | state_tmp_dir= 414 | state_uncompress= 415 | 416 | state_awk_ok=no 417 | state_curl_ok=no 418 | state_tar_ok=no 419 | state_unzip_ok=no 420 | state_wget_ok=no 421 | state_xattr_ok=no 422 | state_bash_ok=no 423 | state_zsh_ok=no 424 | 425 | process_flags "$@" 426 | print_banner 427 | setup 428 | create_home 429 | download_release 430 | install_release 431 | update_config_files 432 | print_success 433 | -------------------------------------------------------------------------------- /scripts/map_sizes.star: -------------------------------------------------------------------------------- 1 | # This script prints sizes of all maps in the cluster 2 | 3 | def main(): 4 | print("# Map Size Report") 5 | print() 6 | 7 | for map_name in object_list("map"): 8 | size = map_size(name=map_name) 9 | output(name=map_name, map_size=size) 10 | -------------------------------------------------------------------------------- /scripts/serialization_report.star: -------------------------------------------------------------------------------- 1 | # This script creates a serialization report 2 | # by traversing all Maps in the cluster and 3 | # getting one of the entries in the map. 4 | 5 | 6 | def main(): 7 | print("# Map Serialization Report") 8 | print() 9 | 10 | for map_name in object_list("map"): 11 | key_set = map_key_set(name=map_name) 12 | if len(key_set) == 0: 13 | output(map=map_name) 14 | continue 15 | view = map_entry_view(key_set[0], name=map_name) 16 | output( 17 | map=map_name, 18 | key_type=data_type(view["Key"]), 19 | value_type=data_type(view["Value"]), 20 | ) 21 | --------------------------------------------------------------------------------