Code Monkey home page Code Monkey logo

gokinate's Introduction

Some examples

First one

gif about the docs

Second one

gif about the nginx

Performance

Examples in the gif(in downloads folder) above run in real time(no persistent quering) on, approximately, 50 000 files on traditional HDD. Basically, speed of collecting data and building a query tree is on par with Walk function in GoLang.

Internally gokinate uses O(N) most prominent faceting tree. Which is, basically, a tree alignment based on most probable order of leafs/tags in a node.

If made right, this tree can allow constant time faceting/drilling down in faceted drilling applications. Index(tree) building is O(N) where N is a number of nodes. We discard here sorting as it is a very small amount(5-10 tags to sort per node).

Installation guide

go get github.com/MichaelLeachim/gokinate;
cd $GOPATH/src/github.com/MichaelLeachim/gokinate;
go build;
go install;
gokinate -p ~/Downloads/;

Extension guide

Altering config file

You can find config file here

cd $GOPATH/src/github.com/MichaelLeachim/gokinate;

Go to the program directory and change attrs.yaml file

Compilling attrs.yaml

You need go-bindata to be installed.

cd $GOPATH/src/github.com/MichaelLeachim/gokinate;
go-bindata "./attrs.yaml";
go build;
go install;

There are four workers available

File extension worker

-
  Worker: ext_worker
  Yes: image_file
  Ask: Is this an image?
  Items:
    - .tif
    - .tiff
    - .gif
    - .jpeg
    - .jpg
    - .nef
    - .png
    - .psd
    - .bmp

It works like that. You associate file extensions with Ask and answer function. Ask & answer are arbitrary fields. They can even, clash with each other.

Path substring worker

-
  Worker: path_substring_worker
  Yes: downloaded
  Ask: Did you download it from the internet?
  Items: [Downloads,Download]

Size range worker

-
  Worker: size_range_worker
  Yes: small_file
  Ask: Is this file small(less than 100 megabytes)?
  Items:  [0,99]

Date range worker

-
  Worker: date_worker
  Yes: yesterday_file
  Ask: Did you get this file yesterday?
  Items:  [1,23]

Writing new extensions

Please, keep in mind, that complex extensions will substantially slow down walking on directory.

For example, I've removed id3 functionality from this program because it took very long time to extract mp3 meta-data. New extension must be placed in extensions.go file. In format:

func (el *Element_yaml) ext_worker(p AttrPath, i os.FileInfo) WorkerReturn {
	data := WorkerReturn{}
	for _, v := range el.Items {
		if v == p.Ext {
			data.Tag = Tag(el.Yes)
			data.TagAsk = el.Ask
			return data
		}
	}
	return data
}

And registered in dispatch tag function:

func Dispatch_Tag(el Element_yaml, p AttrPath, f os.FileInfo) WorkerReturn {
	result := WorkerReturn{}
	if el.Worker == "ext_worker" {
		result = el.ext_worker(p, f)
	}
	if el.Worker == "date_worker" {
		result = el.date_worker(p, f)
	}
	if el.Worker == "size_range" {
		result = el.size_range_worker(p, f)
	}
	if el.Worker == "path_substring_worker" {
		result = el.path_substring_worker(p, f)
	}
	return result
}

gokinate's People

Contributors

pmapcat avatar

Watchers

 avatar

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.