Skip to content

Commit

Permalink
Merge pull request #12 in PDT/cinder-cli from command-option-refactor…
Browse files Browse the repository at this point in the history
… to master

Squashed commit of the following:

commit 638f64b1cb295e0889d46bab69b2d1a8a46a88df
Author: Paul Sandoz <psandoz@netflix.com>
Date:   Tue Jul 9 14:42:26 2019 -0700

    Refine log level values.

commit ab0cdacfa331d204e1ea6bafee1d22dc4e122491
Author: Paul Sandoz <psandoz@netflix.com>
Date:   Mon Jul 8 09:25:30 2019 -0700

    Refactor command options.

    - Lower case environment options and remove "local_" prefix.

    - Replace general verbose option with logging and levels.

    - Move port from general options to explore/history/diff.

    - Change graph output to format.
  • Loading branch information
Paul Sandoz committed Jul 10, 2019
1 parent 65a33d1 commit 9751217
Show file tree
Hide file tree
Showing 8 changed files with 267 additions and 139 deletions.
54 changes: 47 additions & 7 deletions README.md
Expand Up @@ -28,7 +28,7 @@ Run from the container:
-p 8080:8080 \
-v $PWD/blob-cache:/blob-cache \
pdt/cinder-cli:latest \
--env=LOCAL_PROD explore cuptokenrecords.v3
--env=prod explore cuptokenrecords.v3

Then browse to http://localhost:8080/.

Expand All @@ -40,15 +40,13 @@ Docker images are published continuously on changes via Jenkins
-p 8080:8080 \
-v $PWD/blob-cache:/blob-cache \
dockerregistry.test.netflix.net:7002/pdt/cinder-cli:latest \
--env=LOCAL_PROD explore cuptokenrecords.v3
--env=prod explore cuptokenrecords.v3

## Commands

### General options

--env=LOCAL | LOCAL_DEV | LOCAL_TEST | LOCAL_PROD (default=LOCAL_TEST)

--port=<int> (default=8080)
--env=local | dev | test | prod (default=test)

--localDir=<file path> (default=".")
A sub-directory "blob-cache" will be created to cache downloaded blobs
Expand All @@ -62,6 +60,11 @@ the announced version less than and closest to the declared version.

### Explore

#### Options

--port=<int> (default=8080)


Explore the latest version, keeping up to date with new announcements

explore <namespace>
Expand All @@ -76,6 +79,7 @@ Explore an explicit version

#### Options

--port=<int> (default=8080)
--maxStates=<int> (default=200) max number of historical states retained


Expand All @@ -97,6 +101,11 @@ keeping up to date with new announcements

### Differ

#### Options

--port=<int> (default=8080)


Diff between two namespaces and versions

diff <namespaceA> <versionA> <namespaceB> <versionB>
Expand Down Expand Up @@ -135,11 +144,42 @@ List all versions within the range:

Present table of the size of type states over versions

size <namespace> <fromVersion> <toVersion>
size <namespace> [<fromVersion> [<toVersion>]]


### Change

Present summary of changes over versions

change <namespace> <fromVersion> <toVersion>
change <namespace> [<fromVersion> [<toVersion>]]


### Fetch

Prefetch all namespace content into the cache

fetch <namespace> [<fromVersion> [<toVersion>]]


### Detail

#### Options

--data=headers | schema (default=headers)
--source= Any of snapshot, delta (default=snapshot,delta)

Detail the meta-data of a namespace

detail <namespace> [<version>]


### Graph

#### Options

--format=text | dot (default=text)


Graph the versions of a namespace

graph <namespace> [<fromVersion> [<toVersion>]]
29 changes: 13 additions & 16 deletions src/main/java/com/netflix/cinder/cli/Environment.java
Expand Up @@ -11,15 +11,12 @@
import java.nio.file.Path;

public enum Environment {
// @@@ change names

LOCAL,
LOCAL_DEV,
LOCAL_TEST,
LOCAL_PROD;

// @@@ Deployed configuration
// DEPLOYED
// @@@ offline (uses only cache)
local,
dev, // @@@ Is this required? should the option be hidden instead?
test,
prod;

interface Factory {
Path localDir();
Expand Down Expand Up @@ -64,13 +61,13 @@ public Factory get(Path localDir) {

public GutenbergFileConsumer getFileConsumer(Path localDir) {
switch (this) {
case LOCAL:
case local:
return GutenbergFileConsumer.localStorageForDevEnvironment(localDir.toString());
case LOCAL_DEV:
case dev:
return GutenbergFileConsumer.localProxyForDevEnvironment();
case LOCAL_TEST:
case test:
return GutenbergFileConsumer.localProxyForTestEnvironment();
case LOCAL_PROD:
case prod:
return GutenbergFileConsumer.localProxyForProdEnvironment();
default:
throw new Error();
Expand All @@ -79,13 +76,13 @@ public GutenbergFileConsumer getFileConsumer(Path localDir) {

public GutenbergValueConsumer getValueConsumer(Path localDir) {
switch (this) {
case LOCAL:
case local:
return GutenbergValueConsumer.localStorageForDevEnvironment(localDir.toString());
case LOCAL_DEV:
case dev:
return GutenbergValueConsumer.localProxyForDevEnvironment();
case LOCAL_TEST:
case test:
return GutenbergValueConsumer.localProxyForTestEnvironment();
case LOCAL_PROD:
case prod:
return GutenbergValueConsumer.localProxyForProdEnvironment();
default:
throw new Error();
Expand Down

0 comments on commit 9751217

Please sign in to comment.