Example #1
0
func (sc *StorageCore) Run(storageWriteChan, storageReadChan chan StorageFunc) {
	sc.InMemoryGraph = propertygraph2go.NewInMemoryGraph()

	sc.Root = sc.InMemoryGraph.CreateVertex(GenerateUuid(), nil)

	ok := true

	for ok {
		select {
		case fun, ok := <-storageWriteChan:
			if ok {
				sc.ExecuteFunc(fun)
			} else {
				panic("StorageCoreCorruption")
			}

		case fun, ok := <-storageReadChan:
			if ok {
				sc.ExecuteFunc(fun)
			} else {
				panic("StorageCoreCorruption")
			}
		}
	}
}
Example #2
0
func NewTensor(dims ...int) (t *Tensor) {
	t = &Tensor{
		graph:     propertygraph2go.NewInMemoryGraph(),
		indexPool: propertygraph2go.NewIndexPool(),
	}

	for _, dim := range dims {
		fmt.Println("Adding", dim)
		t.addDim(dim)
	}
	return
}