Git Product home page Git Product logo

synapse's Introduction

Synapse

A Distributed RESTful and Plugable Matching Engine.

Usage

WIP.

func main() {
	config := synapse.Config{}
	err := config.LoadYAML("synapse.yaml")
	if err != nil {
		panic(err)
	}

	syn, err := synapse.NewSynapse(config)
	if err != nil {
		panic(err)
	}

	ctx := synapse.Context{"user_id": "1"}
	hits, err := syn.Match("users_products", ctx)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%v\n", hits.IDs) // [10 15 30]
}
plugin_dir: plugins
matchers:
  -
    name: users_products
    profilers:
      -
        name: profiler
        version: 0.0.1
    associator:
      name: associator
      version: 0.0.1
    searcher:
      name: searcher
      version: 0.0.1

Architecture

Distributed matching engine

Synapse selects the matching algorithm by Router. Matching algorithms are provided as plugins and distributed processing is also possible.

synapse

Plugable matching engine

Matcher is composed of profilers, associator and searcher. This is provided as a plugin.

synapse

Profilers are filter group that converts subject and context into profile. Associator is a filter that associates profile and context with cluster. Searcher is a filter that searches for cluster using context, profile and association. This also sorts the search results.

Plugin

You can prepare custom plugins. Plugins must be implemented as Profiler or Associator or Searcher interface, and be published with permitted function names, "NewProfiler", "NewAssociator" and "NewSearcher".

package main

import "github.com/monochromegane/synapse"

type profiler struct {
}

// Implement interface
func (p *profiler) Profile(ctx synapse.Context) (synapse.Profile, error) {
	return synapse.Profile{}, nil
}

func (p *profiler) Initialize() error {
	return nil
}

func (p *profiler) Finalize() error {
	return nil
}

// Export new func
func NewProfiler() synapse.Profiler {
	return &profiler{}
}

And build as plugin.

$ go build -buildmode=plugin -o PLUGIN_NAME.so.x.x.x PLUGIN_NAME.go

synapse's People

Contributors

monochromegane avatar

Stargazers

Doru Carastan avatar Cosmin Harangus avatar Tomohisa Oda avatar  avatar

Watchers

june29 avatar amacou avatar James Cloos avatar  avatar Hiroka Zaitsu avatar TAKAHASHI Manaka avatar  avatar  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.