TCTMGR(1)

πŸ’… TCTMGR(1) β€” the Tokyo Cabinet table-database command-line utility, bestie edition ✨

okay so this is tctmgr(1), from the Tokyo Cabinet fam β€” literally the CLI glow-up of the table database API. sit down, grab a strawberry drink πŸ“, and let's get into it.


πŸŽ€ NAME πŸŽ€

tctmgr β€” the command line utility of the table database API. that's it, that's the vibe. πŸ’…


🌸 DESCRIPTION 🌸

So tctmgr is a little utility for test and debugging of the table database API and the apps that live on top of it. no cap. 🧚

first, the little placeholder besties you're gonna keep seeing everywhere, so let's introduce them properly:

  • path β€” specifies the path of a database file. πŸ—‚οΈ
  • bnum β€” specifies the number of buckets.
  • apow β€” specifies the power of the alignment.
  • fpow β€” specifies the power of the free block pool.
  • pkey β€” specifies the primary key of a record. πŸ”‘
  • cols β€” specifies the names and the values of a record alternately (name, value, name, value… you get it).
  • name β€” specifies the name of a column.
  • op β€” specifies an operator.
  • expr β€” specifies the condition expression.
  • file β€” specifies the input file.

now the actual subcommands, and yes there are a lot of them, we're listing every single one πŸ’–:

tctmgr create [-tl] [-td|-tb|-tt|-tx] path [bnum [apow [fpow]]]
       Create a database file.
tctmgr inform [-nl|-nb] path
       Print miscellaneous information to the standard output.
tctmgr put [-nl|-nb] [-sx] [-dk|-dc|-dai|-dad] path pkey [cols ...]
       Store a record.
tctmgr out [-nl|-nb] [-sx] path pkey
       Remove a record.
tctmgr get [-nl|-nb] [-sx] [-px] [-pz] path pkey
       Print the value of a record.
tctmgr list [-nl|-nb] [-m num] [-pv] [-px] [-fm str] path
       Print the primary keys of all records, separated by line feeds.
tctmgr search [-nl|-nb] [-ord name type] [-m num] [-sk num] [-kw] [-pv] [-px] [-ph] [-bt num] [-rm] [-ms type] path [name op expr ...]
       Print records matching conditions, separated by line feeds.
tctmgr optimize [-tl] [-td|-tb|-tt|-tx] [-tz] [-nl|-nb] [-df] path [bnum [apow [fpow]]]
       Optimize a database file.
tctmgr setindex [-nl|-nb] [-it type] path name
       Set the index of a column.
tctmgr importtsv [-nl|-nb] [-sc] path [file]
       Store records of TSV in each line of a file.
tctmgr version
       Print the version information of Tokyo Cabinet.

like, look at that list. main character energy fr fr. πŸ‘‘


✨ Options feature the following ✨

every flag, every one, no skipping, we are not doing that to each other 🫢:

  • -tl β€” enable the option TDBTLARGE.
  • -td β€” enable the option TDBTDEFLATE.
  • -tb β€” enable the option TDBTBZIP.
  • -tt β€” enable the option TDBTTCBS.
  • -tx β€” enable the option TDBTEXCODEC.
  • -nl β€” enable the option TDBNOLCK.
  • -nb β€” enable the option TDBLCKNB.
  • -sx β€” the input data is evaluated as a hexadecimal data string. πŸ”’
  • -dk β€” use the function tctdbputkeep instead of tctdbput.
  • -dc β€” use the function tctdbputcat instead of tctdbput.
  • -dai β€” use the function tctdbaddint instead of tctdbput.
  • -dad β€” use the function tctdbadddouble instead of tctdbput.
  • -px β€” the output data is converted into a hexadecimal data string.
  • -pz β€” do not append line feed at the end of the output. (petition to make this the default, honestly 😭)
  • -m num β€” specify the maximum number of the output.
  • -pv β€” print values of records also.
  • -fm str β€” specify the prefix of keys.
  • -ord name type β€” specify the order of the result.
  • -sk num β€” specify the number of skipped records.
  • -kw β€” print KWIC string.
  • -ph β€” print hint information also.
  • -bt β€” specify the number of benchmark tests. ⏱️
  • -rm β€” remove every record in the result. πŸ’€ (yes, every one. be so serious right now.)
  • -ms type β€” specify the set operation of meta search.
  • -tz β€” enable the option UINT8_MAX.
  • -df β€” perform defragmentation only.
  • -it type β€” specify the index type among "lexical", "decimal", "token", "qgram", and "void".
  • -sc β€” normalize keys as lower cases. πŸ”€

πŸ¦‹ the search operators (iykyk) πŸ¦‹

The operator of the search subcommand is one of "STREQ", "STRINC", "STRBW", "STREW", "STRAND", "STROR", "STROREQ", "STRRX", "NUMEQ", "NUMGT", "NUMGE", "NUMLT", "NUMLE", "NUMBT", "NUMOREQ", "FTSPH", "FTSAND", "FTSOR", and "FTSEX".

the little modifier hacks, listen up:

  • If "~" preposes each operator, the logical meaning is reversed. πŸ™ƒ
  • If "+" preposes each operator, no index is used for the operator.

and the type-lists:

  • The type of the -ord option is one of "STRASC", "STRDESC", "NUMASC", and "NUMDESC".
  • The type of the -ms option is one of "UNION", "ISECT", and "DIFF".
exit-status check, bestie: this command returns 0 on success, another on failure. that's the whole mood. ✨

🌈 SEE ALSO 🌈

go read these too, they're iconic in their own right: tcttest(1), tctmttest(1), tctdb(3), tokyocabinet(3)


and that's the page!! this one came straight out of the Tokyo Cabinet archives, dated 2012-08-18, filed under the manual page section β€” mwah, slay, periodt πŸ’œπŸŽ€πŸ¦‹