xref: /spdk/examples/blob/cli/README.md (revision bf30e09abe1667ae2769aa367cde39c550bcac00)
1 # blob-cli
2 
3 The blobcli tool has several options that are listed by using the -h command
4 however the three operating modes are covered in more detail here:
5 
6 ## Command Mode
7 
8 This is the default and will just execute one command at a time. It's simple
9 but the downside is that if you are going to interact quite a bit with the
10 blobstore, the startup time for the application can be cumbersome.
11 
12 ## Shell Mode
13 
14 You startup shell mode by using the -S command. At that point you will get
15 a "blob>" prompt where you can enter any of the commands, including -h,
16 to execute them. You can still enter just one at a time but the initial
17 startup time for the application will not get in the way between commands
18 anymore so it is much more usable.
19 
20 ## Script (aka test) Mode
21 
22 In script mode you just supply one command with a filename when you start
23 the cli, for example `blobcli -T test.bs` will feed the tool the file
24 called test.bs which contains a series of commands that will all run
25 automatically and, like shell mode, will only initialize one time so is
26 quick.
27 
28 The script file format (example) is shown below.  Comments are allowed and
29 each line should contain one valid command (and its parameters) only. In
30 order to operate on blobs via their ID value, use the token $Bn where n
31 represents the instance of the blob created in the script.
32 
33 For example, the line `-s $B0` will operate on the blobid of the first
34 blob created in the script (0 index based). `$B2` represents the third
35 blob created in the script.
36 
37 If you start test mode with the additional "ignore" option, any invalid
38 script lines will simply be skipped, otherwise the tool will exit if
39 it runs into an invalid line (ie './blobcli -T test.bs ignore`).
40 
41 Sample test/bs file:
42 
43 ~~~{.sh}
44 # this is a comment
45 -i
46 -s bs
47 -l bdevs
48 -n 1
49 -s bs
50 -s $B0
51 -n 2
52 -s $B1
53 -m $B0 Makefile
54 -d $B0 M.blob
55 -f $B1 65
56 -d $B1 65.blob
57 -s bs
58 -x $B0 b0key boval
59 -x $B1 b1key b1val
60 -r $B0 b0key
61 -s $B0
62 -s $B1
63 -s bs
64 ~~~
65