Example #1
0
func New() *ACL {
	profilestore, e := cayley.NewMemoryGraph()
	if e != nil {
		log.Fatalln(e)
	}
	groupstore, e := cayley.NewMemoryGraph()
	if e != nil {
		log.Fatalln(e)
	}

	return &ACL{
		profilestore: profilestore,
		groupstore:   groupstore,
	}
}
Example #2
0
func (t *ModelTestSuite) SetUpTest(c *C) {
	memGraph, _ := cayley.NewMemoryGraph()
	memNg, _ := graph.NewGraph(memGraph)

	t.nodeGraph, t.tmpDir = testutils.TestInit()
	t.server = httptest.NewServer(api.NewApi(memNg))
	t.client = apiclient.ApiClient{t.server.URL, api.JsonEncoding}
}
Example #3
0
// WrapLocal initializes a new Signalling decorator that wraps the provided base service
func WrapLocal(service common.IServiceRegistry, signalOut chan<- evt.Event) (common.IServiceRegistry, error) {
	var wrapper = new(localSignallingLayer)
	wrapper.base = service
	wrapper.signalOutput = signalOut

	var graph, err = cayley.NewMemoryGraph() //TODO (enzian) eval possibility to reuse the graph in the MgoRegistryService layer!
	if err != nil {
		return nil, err
	}

	wrapper.graph = graph

	return wrapper, nil
}
Example #4
0
func initDb() (*graph.NodeGraph, error) {
	var handle *cayley.Handle
	var err error
	if !debug {
		dbPath := filepath.Join(env.EnvPath(env.DbPath), "db.dat")
		if !env.Exists(dbPath) {
			if err = cgraph.InitQuadStore("bolt", dbPath, nil); err != nil {
				return nil, err
			}
		}
		if handle, err = cayley.NewGraph("bolt", dbPath, nil); err != nil {
			return nil, err
		}
	} else {
		if handle, err = cayley.NewMemoryGraph(); err != nil {
			return nil, err
		}
	}

	return graph.NewGraph(handle)
}