Coder Social home page Coder Social logo

clique's People

Contributors

andrewjstone avatar baranga avatar borshop avatar cmeiklejohn avatar codeadict avatar eproxus avatar fadushin avatar jadeallenx avatar jvoegele avatar licenser avatar macintux avatar martinsumner avatar nickelization avatar ooshlablu avatar seancribbs avatar tburghart avatar thomasarts avatar vagabond avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

clique's Issues

Incorrect dependencies in clique [JIRA: RIAK-2125]

The app dependencies in rebar.config and .app.src are not in sync with the actual usage in the clique application.

This is currently one of the blockers for using riak_core as a dependency in your own project - at least if you want to use relx and rely on proper OTP rules for releases.

clique problems:
'IN_called_IN_deps_NOT_appsrc': [cuttlefish]
'IN_called_NOT_deps_NOT_appsrc': [mochiweb]

The fix is to simply bring the files in sync with reality.

[Created in JIRA by Torben Hoffmann]

Config set/show does not work with transformations

When cuttlefish config uses transformations, and is not a direct 1:1 mapping from riak.conf key to appenv key, the automagically generated set/show commands do not work. This almost certainly requires a bit of work to cuttlefish as well.

Friendlier set/show/describe

Current:

$ ./riak-admin set
Config Operations require one or more arguments
$ ./riak-admin set foo
Not a Key/Value argument of format: "foo"=<Value>:

$ ./riak-admin set foo=bar
Conf file attempted to set unknown variable: foo

Suggested:

$ ./riak-admin set
Usage: riak-admin set <variable>=<value> [-n <node>|--all]
$ ./riak-admin set foo
Usage: riak-admin set <variable>=<value> [-n <node>|--all]
$ ./riak-admin set foo=bar
Unknown configuration variable: foo

Build failure on OTP 22

Due to the deprecation of erlang:get_stack_trace() erlang/otp#1783

===> Compiling _build/default/lib/clique/src/clique_test_group_leader.erl failed
_build/default/lib/clique/src/clique_test_group_leader.erl:118: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace

The simple fix is to update the catch to the new try/catch syntax but that'll break older versions. Otherwise adding an ignore deprecations flag to the project should work.

    try apply(M, F, A) of
        Chars ->
            io_request({put_chars, Chars}, State)
    catch C:T:S ->
            {{error, {C,T, S}}, State}
    end;

Build failure with OTP 20

src/clique_usage.erl:23: export_all flag enabled - all functions will be exported
Compiling src/clique_usage.erl failed:
DEBUG: Worker compilation failed: {{error,
                                    {error,[],
                                     [["src/clique_usage.erl:23: export_all flag enabled - all functions will be exported\n"]]}},                                                                                                            
                                   {source,"src/clique_usage.erl"}}

Typecasting errors can't be customized

clique_error defines how to format all errors, but if I want to validate a flag is properly formed, I can't customize the output (actually I'll probably get function_clause). Example typecasting function:

ip(String) ->
    try
        [Ip, PortStr] = string:tokens(String, ":"),
        {ok, _} = inet_parse:address(Ip),
        Port = list_to_integer(PortStr),
        {Ip, Port}
    catch
        error:badarg ->
            {error, port_is_not_integer};
        error:badmatch ->
            {error, invalid_address}
    end.

I should be able to use symbolic errors in this case or handle them explicitly by running the command with flagged inputs. Currently I can do neither because clique_error is called immediately upon encountering an error.

Trailing equal sign in argument value

Fix for #85 was resolving problem of equal sign in the middle of value.

If one or more = signs are at the end of the value - they are all removed.

Following test case in src/clique_parser.erl will fail:

parse_valid_arg_value_with_trailing_equal_sign_test() ->
    Spec = spec(),
    ArgsAndFlags = ["client-id=anon-Base64v=="],
    {Spec, Args, Flags} = parse({Spec, ArgsAndFlags}),
    ?assertEqual(Args, [{"client-id", "anon-Base64v=="}]),
    ?assertEqual(Flags, []).

Don't throw error on empy argument

I tried to use an empty value argument like the following:

$ my-cli command foo=

And results in the following error:

    {'EXIT',
     {function_clause,
      [{clique_error,
	format,
	["my-cli",
	 {error,
	  {invalid_kv_arg,
	   "foo"}}],
	[{file,
	  "/mycli/_build/default/lib/clique/src/clique_error.erl"},
	 {line,
	  29}]},
       {clique,
	print,
	3,
	[{file,
	  "/mycli/_build/default/lib/clique/src/clique.erl"},
	 {line,
	  109}]},
       {clique,
	print,
	2,
	[{file,
	  "/mycli/_build/default/lib/clique/src/clique.erl"},
	 {line,
	  92}]},
       {rpc,
	'-handle_call_call/6-fun-0-',
	5,
	[{file,
	  "rpc.erl"},
	 {line,
	  197}]}]}
}

IMHO, instead of raising an error clique should pass an empty string "" as the value or even better catch the error and show a clique message instead of the stack trace.

number support

Would be useful to support numeric values as alternatives to textual values.

Currently:

-type text() :: {text, iolist()}.
-type column() :: {column, iolist(), [iolist()]}.
-type table() :: {table, [{iolist(), iolist()}]}.

Proposed:

-type text() :: {text, iolist()}.
-type column() :: {column, iolist(), [iolist()|number()]}.
-type table() :: {table, [{iolist(), iolist()|number()}]}.

Optionally: -type numeric() :: {numeric, number()}.

Global flags don't apply to all commands properly

It looks like there has been an issue for a while where the --help flag doesn't work on all commands. More recently, the --format flag has been added, and that appears to suffer from the same problem.

For some of the commands, it's easy to see why would be the case (set/show/describe), but I'm also seeing the same issue with an application-defined command (riak-admin cluster status), so I suspect there might be more than one thing that needs to be fixed here.

Running "set" command on down node shows no output

If you use the set command and use the --node flag to point to a node that's down, we should print some kind of an error message. Right now nothing is printed to the console, which makes it appear as though the command succeeded.

Make command callbacks only run on local node

When using the set command the registered callback will be called on local or remote nodes automatically depending upon the --node and --all flags. Right now however, command callbacks must do the cross node calls themselves instead of being told where to run. Make this more inline with set and call the functions in the right locations automatically.

Fix function clause error when trying to use 'show' on a down node

Andrews-MacBook-Pro:riak_ee ajs$ dev/dev1/bin/riak-admin show transfer_limit -n [email protected]
RPC to '[email protected]' failed: {'EXIT',
                                 {function_clause,
                                  [{clique_status,parse,
                                    [{badrpc,nodedown},
                                     #Fun<clique_human_writer.0.113743305>,
                                     {context,false,[]}],
                                    [{file,"src/clique_status.erl"},
                                     {line,37}]},
                                   {clique_human_writer,write,1,
                                    [{file,"src/clique_human_writer.erl"},
                                     {line,36}]},
                                   {clique,print,2,
                                    [{file,"src/clique.erl"},{line,71}]},
                                   {rpc,'-handle_call_call/6-fun-0-',5,
                                    [{file,"rpc.erl"},{line,205}]}]}}

Some columns get larger when width is too small.

If terminal width is too small the some columns are made wider than normal.
Perhaps we should break into multiple outputs if insufficient width.

ubuntu@riak105:~$ sudo riak-admin handoff details
Type Key: O = Ownership, H = Hinted, Rz = Resize, Rp = Repair
+-------------+--+-------+----+---------------+---------------++
|    Type     |So|Target:|Size|  Rate (KB/s)  |       %       ||
+-------------+--+-------+----+---------------+---------------++
|      O      |ri|riak@ri|611.|    608.96     |    329.16     ||
|      O      |ri|riak@ri|686.|    603.99     |    287.46     ||
+-------------+--+-------+----+---------------+---------------++
ubuntu@riak105:~$ 
ubuntu@riak105:~$ sudo riak-admin handoff details
Type Key: O = Ownership, H = Hinted, Rz = Resize, Rp = Repair
+----+-------------------+-------------------+--------+-----------+------+------------------+
|Type|     Source:ID     |     Target:ID     |  Size  |Rate (KB/s)|  %   |      Sender      |
+----+-------------------+-------------------+--------+-----------+------+------------------+
| O  |[email protected]:17|[email protected]:17|661.3 MB|  910.14   | 16.11|<25397.31465.1017>|
| O  |[email protected]:42|[email protected]:42|704.4 MB|  846.67   | 22.39|<25398.4560.1436> |
+----+-------------------+-------------------+--------+-----------+------+------------------+

Improve table resizing so columns are more evenly sized

Table columns, when the console is too small, are resized in a very uneven/unfair way. For example, take the following code:

Table = [[{foo, "Foo"}, {bar, "Bar"}, {baz, "Another"}, {buzz, "Yup"}, {"Transfer Rate","127 kbp[[{foo,"Foo"},"1280 objs"}, {pid, "<14479.003>"}]].
clique:print([clique_status:table(Table)], fun clique_human_writer:write/1).

If you run this in a console window that's a normal size, you'll get

+---+---+-------+----+-------------+---------+-----------+
|foo|bar|  baz  |buzz|Transfer Rate|  Size   |    pid    |
+---+---+-------+----+-------------+---------+-----------+
|Foo|Bar|Another|Yup |  127 kbps   |1280 objs|<14479.003>|
+---+---+-------+----+-------------+---------+-----------+

Now, shrink your console to be exactly wide enough to show that table, and run clique:print([clique_status:table(Table)], fun clique_human_writer:write/1). again. This time, you get:

+-----------+--------+------------+---+------+--+--+
|    foo    |  bar   |    baz     |buz|Transf|Si|pi|
+-----------+--------+------------+---+------+--+--+
|    Foo    |  Bar   |  Another   |Yup|127 kb|12|<1|
+-----------+--------+------------+---+------+--+--+

Need to find a better method of resizing the columns.

Equal sign as argument value

I tried to use a equal sign (=) as value but it fails with:

$ my-cli do-something url=example.com?q=dada
Too many equal signs in argument: "url=example.com?q=dada"

IMHO clique should pass down any additional equal sign as part of value. At least it should provide a way to escape them.

Add global flag support

We want to allow the user to dictate at runtime the type of output of the system.

For instance, we want --help to always show help for the given command, but we don't want to make the user check whether the help command was run for each and every command.

We also will want to set the writer so that the values are output in a different manner. For example, we can use --csv to output in csv format instead of a human readable format for every command.

Having global flags will allow us to add different writers in the future.

Crash on terminal width too small

Used in riak, running riak-admin cluster status spits this out on the console

failed: {'EXIT',
                                                   {function_clause,
                                                    [{lists,seq,
                                                      [1,-1],
                                                      [{file,"lists.erl"},
                                                       {line,228}]},
                                                     {clique_table,char_seq,
                                                      2,
                                                      [{file,
                                                        "src/clique_table.erl"},
                                                       {line,196}]},
                                                     {clique_table,
                                                      '-vertical_border/1-lc$^0/1-0-',
                                                      1,
                                                      [{file,
                                                        "src/clique_table.erl"},
                                                       {line,191}]},
                                                     {clique_table,
                                                      '-vertical_border/1-lc$^0/1-0-',
                                                      1,
                                                      [{file,
                                                        "src/clique_table.erl"},
                                                       {line,192}]},
                                                     {clique_table,
                                                      vertical_border,1,
                                                      [{file,
                                                        "src/clique_table.erl"},
                                                       {line,191}]},
                                                     {clique_table,
                                                      create_table,4,
                                                      [{file,
                                                        "src/clique_table.erl"},
                                                       {line,71}]},
                                                     {clique_human_writer,
                                                      write_table,1,
                                                      [{file,
                                                        "src/clique_human_writer.erl"},
                                                       {line,67}]},
                                                     {clique_human_writer,
                                                      write_status,2,
                                                      [{file,
                                                        "src/clique_human_writer.erl"},
                                                       {line,57}]}]}}

Show usage information for config values

We currently have no way of showing usage for cuttlefish config. We probably want something like:
riak-admin config transfer_limit or riak-admin usage transfer-limit where it shows the usage information that is written in the cuttlefish schemas.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.