1
0
Fork 0
mirror of https://github.com/KingDuckZ/dindexer.git synced 2024-12-04 02:25:41 +00:00
Commit graph

351 commits

Author SHA1 Message Date
efd7118189 Add support for single chars to the run() method. 2016-06-14 09:10:45 +01:00
9a69b8de10 Throw if Redis reply contains any error messages. 2016-06-13 17:33:25 +01:00
93e328d77f Remove unnecessary usage of recursive_wrapper. 2016-06-13 17:27:52 +01:00
316f8f585b Rename RedisReplyType to just Reply. 2016-06-13 17:00:12 +01:00
533b571771 Implement ZSCAN Redis command. 2016-06-13 16:20:54 +01:00
78eee0e16f Make the scan command in ScanPairs a template parameter. 2016-06-13 16:20:31 +01:00
9949c273a1 Implement SSCAN Redis command. 2016-06-13 15:38:18 +01:00
731582d8fe Move V into ValueFetch.
No need to explicitly specify the dereferenced type directly to
the scan iterator anymore.
2016-06-13 15:24:26 +01:00
c7eeddabf1 Implement HSCAN Redis command. 2016-06-13 15:14:10 +01:00
e0a82cce2d Fix SCAN iteration. 2016-06-13 10:57:42 +01:00
c1e79c435b New ScanIterator class.
Not yet tested and only supporting the SCAN command for now, more to
come.
Also includes some refactoring that was needed to make everything work.
2016-06-10 20:33:11 +02:00
04b667485e Add optional database selection parameter in yml file. 2016-06-10 09:55:37 +02:00
8bdb1f237f Replace spaces with tabs 2016-06-09 22:55:38 +02:00
49a8e81fed Restore adding sets into Redis using the new run() method.
Partial implementation - not for use in real world cases.
2016-06-09 22:20:22 +02:00
f7a7015c65 Start putting Redis stuff in a wrapper class.
Nonworking, but the project builds.
2016-06-09 19:24:08 +02:00
db23dcea3f Add missing implementation and fix crashes in redis backend.
With this you can insert a new set (set only, no files) with dindexer-scan.
2016-06-07 23:13:24 +01:00
2d2c7d0b9e Merge remote-tracking branch 'origin/dev' into dev 2016-06-07 22:46:09 +01:00
0ab66fa1f1 Stub implementation of a Redis backend. 2016-06-07 22:45:30 +01:00
3fe962a8e5 Make symlink to postgresql backend
This is helpful so when running dindexer in a dev environment you don't
need to list all the possible paths to every backend. Symlinks to all
backends will all be in the same place.
2016-06-06 20:24:05 +02:00
624bba121f Remove hardcoded path to postgresql backend and make the search dynamic 2016-06-06 19:54:20 +02:00
a1490c3096 Make split_tags a bit more generic so I can reuse it
I need it in an upcoming commit where I want to split on ':'
2016-06-06 19:52:42 +02:00
d5cf8e21b2 Add cleaning of the new uuid and label properties 2016-06-04 01:13:47 +02:00
2057c797cb SetRecordData is not really needed anymore so get rid of it
Always use SetRecordDataFull now.
2016-06-04 01:13:26 +02:00
7117ff7be2 Save and read label and uuid to the database 2016-06-04 01:03:20 +02:00
55a61526dc Fix DiscInfo and make it find label and uuid correctly.
It's not the mountpoint's inode that I needed, but that of the dev!
2016-06-04 01:02:37 +02:00
f0e67f1c97 Fix wrong block of code
Backend plugin was not being initialized due to some copy paste error.
2016-06-03 21:50:45 +02:00
5e1dfe3749 Warning fix in clang. 2016-06-03 20:27:07 +02:00
742d024bfb Implement label and uuid retrieval for the disk being scanned. 2016-06-03 20:26:54 +02:00
61b0b586cf Clean up code to handle failed attempts at loading backend plugins. 2016-06-02 21:16:19 +02:00
7de71943ad Name backend settings section in yml using the backend name itself. 2016-06-02 18:38:40 +02:00
e2275ce5db Add a backend interface version number for eventual future changes.
Note that the interface is still a work in progress and might change
while still keeping the same interface version. This is going to be true
until the first stable release of this project (non beta).
2016-06-02 10:01:19 +02:00
0cb91fb9ca Put LIMIT number into a common header. 2016-06-02 09:42:32 +02:00
dfe3655296 Re-enable navigate in the postgre plugin. 2016-06-02 09:35:33 +02:00
780cd9b0ca Re-enable locate in the postgre plugin. 2016-06-01 10:29:23 +02:00
3608d7b76c Re-enable scan in the postgre plugin.
This also adds a public dependency to machinery in the header-only
backend project. This is because the backend does need functionality
from machinery, such as FileRecordData and TigerHash.
2016-05-31 20:03:31 +02:00
8f51f82abc Re-enable delete subcommand 2016-05-31 10:30:16 +02:00
df2e04a029 Fix tagging.
Tag functions are now fully available through the new plugin.
2016-05-27 21:51:15 +02:00
c009c07c9d Temporarily disable broken stuff 2016-05-27 21:50:09 +02:00
3927f945ca Move postgresql header files to the src directory
They are private, and anyways no client needs to include anything at all
from the various backends.
2016-05-27 21:49:50 +02:00
20b2a8695e Load postgresql plugin and use that in tag.
Only partially implemented.
2016-05-27 20:31:07 +02:00
c97a08860f Get rid of the DB_BACKEND build setting. 2016-05-27 20:29:32 +02:00
064fc0cf1a Create intermediate backend lib to help loading backend plugins. 2016-05-27 20:28:26 +02:00
1fd51f75ba Rename namespace dinbpostgres to dindb.
It's so much better!
2016-05-24 09:57:04 +02:00
45fc758915 Print db backend name in --builtin view 2016-05-24 09:57:03 +02:00
8f98495049 Make dindexer-common depend on postgre backend and fix build 2016-05-24 09:57:03 +02:00
fb722719b2 Move postgresql backend's include files to a new db subdir.
Fix build and remove unneeded include in tag.cpp
2016-05-24 09:57:03 +02:00
70caa9e26c Move db dbsource files to the postgresql backend lib and rename namespace. 2016-05-24 09:57:02 +02:00
baa67138eb Move MaxSizedArray to helpers include dir. 2016-05-24 09:57:02 +02:00
b6d45eee3c Move db scan functions to the postgresql backend lib. 2016-05-22 03:17:26 +01:00
641261306f Move db locate functions to the postgresql backend lib. 2016-05-22 03:05:58 +01:00
45ecdb9a2b Move db delete to the postgresql backend lib. 2016-05-22 03:02:39 +01:00
5203fbece2 Move db tagging functions to a new postgresql backend lib. 2016-05-22 02:54:49 +01:00
62bf47d0ed Warning fix on clang 2016-05-19 20:25:00 +02:00
6e9203faa0 Buildfix on some recent clang versions 2016-05-19 20:17:28 +02:00
7cfc25aeeb Implement tag deletion. 2016-05-19 20:17:05 +02:00
adcdf56254 Extract some code in a separate function. 2016-05-19 09:48:22 +02:00
43cbad47cb Fix scan progress messages not clearing up correctly 2016-05-18 22:28:00 +02:00
b52271e2b8 Add an option to limit tagging to a given set only. 2016-05-18 21:18:46 +02:00
9d76957c7f Allow multiple globs on the command line to tag command. 2016-05-18 10:26:34 +02:00
ad556f4be4 Use new case sensitivity option from glob2regex
Don't append crap manually to regular expressions.
2016-05-18 10:25:23 +02:00
6b5fe85571 Make mime_type and mime_charset on the fly
For the same motivation explained in the parent commit, make string_refs
on the fly instead of storing them.
2016-05-17 21:12:44 +02:00
8c03ba15bc Crash fix - make path on the fly
Newer versions of gcc have a small string optimizations that makes
moving FileRecordData objects behave incorrectly. When a small string is
moved, string_refs into it become invalid. Making a path on the fly
using the path() method also has the side effect of making
FileRecordData smaller in size.
2016-05-17 20:21:44 +02:00
21c5b3efcb Allow tagging files by glob
Tagging by ID is still possible using the --ids switch, which takes a
comma-separated list of IDs. However only one mode is allowed at time,
so either tag by glob OR tag by ID.
2016-05-17 19:54:05 +02:00
67bdabb548 Allow --tags option in locate command.
When a comma separated list of tags is specified, locate searches for
filenames matching the given glob that also belong to all of the
specified tags.
2016-05-16 23:45:08 +02:00
5832ca3374 Move split_tags to common lib. 2016-05-16 09:59:10 +02:00
1192ce7c18 Warning fix on gcc 2016-05-14 16:14:58 +02:00
0f308455ca Implement tagging files by database id 2016-05-13 20:48:03 +02:00
537023dbfa Fix build error when passing a vector<string_ref> to query() 2016-05-13 20:46:13 +02:00
94ebfbdfcb Move git hash into a dedicated .h so less compiling happens after a commit 2016-05-13 10:21:45 +02:00
fde1355653 Enable searching by glob in locate command. 2016-05-12 20:49:11 +02:00
b6953eeaa1 Add unit test for tag splitting 2016-05-05 20:05:56 +02:00
6afc16fe5b Accept a comma-separated list of tags as the first parameter in tag 2016-05-05 19:10:46 +02:00
da222940ca Update copyright year in -h message
Also make it nicer/easier (hopefully) to remember and to update it next
time.
2016-05-04 19:39:46 +02:00
9ae2474f58 Accept file or set ids on the command line 2016-05-04 10:04:20 +02:00
a508a22af8 New empty action "tag" 2016-05-04 09:43:54 +02:00
265337607e Fix segfault when no actions are found. 2016-04-30 19:41:00 +02:00
76a289df62 Improve aspect of tab-completion in navigate 2016-04-30 19:40:35 +02:00
76388be56e Refactoring in listdircontent. 2016-04-29 23:27:56 +02:00
0b6e6ad1d6 Move path composition knowledge into EntryPath. 2016-04-28 22:19:28 +02:00
489d545c60 Rename GenericPath to EntryPath. 2016-04-28 10:20:27 +02:00
b71a94ef70 Implement basic tab completion in navigate.
It doesn't work super well and it's missing set number
completion, but it's a step forward.
2016-04-28 00:05:22 +02:00
1ef879e9c1 Define all case combinations of cmake_on/off.
This saves having to remember to do STRING(TOUPPER) in every cmake file.
At times that's really not convenient if possible at all.
For example when a top-level project is guessing what option some
subproject is going to use and tries to use it for the builtin options
view. The acutal OPTION statement is not there, and it's not nice to put
a string(toupper) on a variable that seems to come from nowhere (and in
fact it might not be there at all).
2016-04-27 01:29:40 +02:00
804a02c63b Show state of WITH_NICE_MEDIA_TYPES in dindexer -b 2016-04-27 01:20:12 +02:00
72ce72273d Put definitions for CMAKE_[ON/OFF] in a common header. 2016-04-27 01:18:38 +02:00
a625f69afd Import better-enums project from github and put it to use :)
Fix build and somewhat improve the dindexer-scan --help message.
2016-04-26 20:47:29 +02:00
c21779adde Tell needed compiler features to cmake instead of -std=c++11 flag 2016-04-26 20:47:29 +02:00
343c44add5 Add an option to compile the build date into dindexer's binary 2016-04-22 01:35:57 +02:00
abde34e240 Add unit test for cli programs 2016-04-21 00:22:00 +02:00
e3e704c50f Bugfixes and improvements 2016-04-21 00:20:00 +02:00
653371763b Treat commands as utf8 when looking for possible mispellings 2016-04-21 00:18:20 +02:00
eaba94fa13 Don't cast malloc.
There is no need to cast the result of library functions that return void *;
it makes your code hard to read, adds no value, and can hide a bug if you don't
have a valid prototype in scope.
See http://c-faq.com/malloc/mallocnocast.html
2016-04-19 11:20:04 +02:00
c26cdb97f5 Print compiler id and version in builtin info 2016-04-19 01:04:57 +02:00
e6bfd0ecfd Merge remote-tracking branch 'gitan/master' 2016-04-19 00:37:57 +02:00
31142a49b3 Implement mispelling suggestions for argument to dindexer 2016-04-19 00:09:38 +02:00
3e130cd346 Import pbl c library 2016-04-18 22:52:35 +02:00
7515705c05 Try to use linereader autocomplete 2016-04-15 15:07:22 +02:00
3a2db550d2 Warning fix on clang 2016-03-18 22:28:58 +01:00
aee6c35ede Gather more build env info and show them when doing -b 2016-03-17 09:50:52 +01:00
ed30de44cf Add --version switch to main program. 2016-03-16 18:49:49 +01:00
417459b806 Bugfix and improve behaviour
The program now tries to be more strict about the command lines it
accepts. See the comment added into main.c for more details.
Also fixed a bug introduced by a previous commit, and another one
about argv not being null-terminated. For some reasons it never
gave problems until now. But it's fixed now, so yeah.
2016-03-16 18:39:18 +01:00
6991fee7f7 Add support for bash autocomplete in main dindexer
I'm not sure this is something that should be in the code, since
compgen -W "delete locate navigate query scan" loc
would do just the same as
dindexer --printactions=loc
so this is a duplicated functionality. However this commit is
self-contained, so it should be easy to revert it, if needed.
2016-03-16 00:01:29 +01:00
c6b0fe49b5 Use getopt_long() to parse command line. 2016-03-15 21:10:52 +01:00
96c6e967a0 Cache result of ls command. 2016-03-15 09:33:12 +01:00
d21a4fa374 Use readline
Maybe this should be made optional?
2016-03-15 08:42:01 +01:00
0f7a78b395 Fix paths with spaces not being treated correctly. 2016-03-14 19:39:58 +01:00
8fc45ce694 Buildfix on ARM 2016-03-12 00:47:08 +01:00
859764b9a4 Merge branch 'hashdir_refactoring' 2016-03-12 00:37:28 +01:00
e95cd6cc44 Add a --byhash switch to the locate command to search by content.
This is mostly to demonstrate the new task classes.
2016-03-12 00:32:15 +01:00
34ead94c8d Restore DB writing functionality.
This ends the scantask refactoring. It is now possible to scan
directories using the new system. Progress feedback is made
available again, although it could use some improvements.
2016-03-10 18:37:42 +01:00
43c8024b0c Re-add some progress feedback.
It's not multithreaded this time o.O
2016-03-10 09:51:27 +01:00
fe7e9c4af9 Turn around Set's tasks so that they provide a SetRecordDataFull. 2016-03-09 21:26:43 +01:00
fd5be6216a Namespace shortcut 2016-03-09 19:11:45 +01:00
c4c68e3b5c Take file size in filesearcher.
Like this the filesize task I was about to write becomes
unnecessary.
2016-03-09 18:55:03 +01:00
85cbc76de4 Add GeneralFiller helper task to group tasks together. 2016-03-09 09:25:52 +01:00
5798e0d315 New Mime task. 2016-03-09 09:02:17 +01:00
217eac250b Include only needed headers 2016-03-08 22:56:23 +01:00
c068f93bac New ContentType task.
Fix the problems I encountered while trying to use the new task.
2016-03-08 19:54:04 +01:00
b357bfb2cc Use basename() instead of the unclear make_rel_path 2016-03-08 19:09:56 +01:00
250b2df846 Add basename() free function. 2016-03-08 19:09:20 +01:00
63c703f20d Fix wrong hashes for directories
set_listing must sort by abs_path, because the path received by
lower_bound() is an absolute path.
Inside hash_dir() the path passed to append_to_vec() is really
the basename of the current item. This will become more clear
in one of the next commits.
2016-03-08 18:58:47 +01:00
7b0189a119 Make debug output a bit nicer. 2016-03-08 08:51:57 +01:00
d2588d3c7e Implement hashing task.
Also get rid of the ShorFileRecordData and put the new LeanBase
class to use.
2016-03-08 08:48:12 +01:00
d579b311f2 Add ShortFileRecordData struct to hold the file list in DirTree. 2016-03-04 21:57:09 +01:00
1956594c01 Move mediatypes.hpp/cpp to machinery.
This was needed so that machinery wouldn't depend on common.
Also moved compatibility.h to helpers include dir.
Ideally mediatypes.hpp will be merged into mediatype.hpp, or there
will be some kind of renaming because the two names are
getting really confusing.
2016-03-04 09:01:11 +01:00
6ddf79fad9 Implement MediaType scan task. 2016-03-03 21:31:33 +01:00
5b3e15c45f Create DirTree class and start moving code around. 2016-03-03 20:46:30 +01:00
b19720548a Fix program hanging in release.
That great idea of spawning a thread for printing to stdout is
firing back. Temporary fix to get past, but the output looks
really broken now.
2016-02-23 23:28:49 +01:00
b55f42e905 Remove debug output. 2016-02-23 21:05:04 +01:00
be9fc3eb0b Fix various problems introduced in scan with the last commit.
Fixes a crash due to an assertion trying to access a
past-the-end iterator.
Gets content type detection to work, although only after
hashing is done (see comment in main.cpp for details).
Fixes a problem with the array passed to guess_content_type
being not sorted as the function expects.
Adds more assertions.
2016-02-23 18:56:07 +01:00
22614432a9 Detect content type after scanning and save to DB. 2016-02-22 19:44:48 +01:00
2e77e4dc0b Add Glob class and use that one to help guessing content types. 2016-02-20 01:36:31 +01:00
f31463480f Add stub code to detect VCDs, plus unit test. 2016-02-19 21:57:43 +01:00
7da13f6677 Add assignment operators. 2016-02-19 21:56:10 +01:00
64b5affa4f Add guess_content_type() function.
WiP.
2016-02-19 10:01:11 +01:00
8a97afd6bf Use Kakoune::SafePtr to hold the PathName in DirIterator. 2016-02-18 21:00:17 +01:00
bb1148863d Add typedefs to SetListingView<B> 2016-02-17 08:54:38 +01:00
af80771c2e Fix the new hash_dir().
This fixes a bug that I never noticed in the old code.
This also breaks the progress indicator in Release.
2016-02-16 23:01:42 +00:00
5fbad40fda Add level offset.
The level in the FileRecordData is 0 at the base of the
directory being scanned. However PathName::atom_count() can be
more than that. For example scanning /mnt/cdrom will have
level 0 at the mount point, but atom_count() is 2. So it's
necessary to pass in this offset. This way the code can take
that into account and compute stuff correctly.
2016-02-16 20:18:10 +00:00
5908828390 Implement hash_dir() using DirIterator. WiP
Keep the old implementation as well, so they can be easily tested.
Uncomment the USE_LEGACY_HASH_DIR define at the top to build with the
old function.
2016-02-16 20:29:50 +01:00
0a3e469951 Support const/non-const DirIterators and SetListingViews 2016-02-16 18:51:17 +01:00
84a2617c24 Enable interoperability between iterators 2016-02-16 18:12:26 +01:00
b94bf308f5 Prepare to allow for non-const iterators.
WiP.
2016-02-12 21:02:26 +01:00
bed191c4fc Better way to construct SetListingView 2016-02-12 20:14:12 +01:00
2a7b8437ed Make DirIterator forward only 2016-02-12 19:55:32 +01:00
32d32f63cb Fix SetListing, but some implementation is still missing 2016-02-12 14:44:32 +01:00
5549e7c97d Show --builtin even when no actions are found. 2016-02-11 09:18:36 +01:00
c89d4b69d5 Add install target. 2016-02-11 09:07:36 +01:00
6362f0f002 Fix unit test 2016-02-10 09:19:54 +01:00
c4a68356f6 Fix a warning in clang 2016-02-10 09:03:31 +01:00
ada0f1df50 Add SetListingView.
I'm having linker errors in gtest, pushing to see
if this also happens on the build server.
2016-02-09 23:23:50 +01:00