Skip to content

acmpesuecc/Onyx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Onyx

Onyx is a embedded, on-disk, concurrent graph database which is built over badger which is aimed at effiecient edge-list scans. Since its a wrapper around badger, Onyx inherits a lot features provided by badger such as:

  • Transaction support
  • ACID compliant
  • Serializable Snapshot Isolation (SSI) guarentee

Note: If you are a contributer, please read CONTRIBUTING.md. YOU WILL NOT UNDERSTAND THE PROJECT OTHERWISE, PLEASE ACTUALLY READ IT

Installation

To install the latest version:

go get https://github.com/Dynaclo/Onyx

Usage

import "github.com/Dynaclo/Onyx"

graph, err := Onyx.NewGraph("", true)
if err != nil {
  panic(err)
}

err = graph.AddEdge("a", "b", nil)
err = graph.AddEdge("a", "c", nil)
err = graph.AddEdge("c", "d", nil)
err = graph.AddEdge("c", "e", nil)

if err != nil {
  panic(err)
}

a_n, err := graph.GetEdges("a", nil)
fmt.Println("Neighbors of a: ", a_n)

a_n, err = graph.GetEdges("c", nil)
fmt.Println("Neighbors of c: ", a_n)

Using Transactions

You can create a *badger.Txn and pass it on as the last arguement of every Onyx graph operation function and the graph operation will be executed in that Onyx transaction. If nil is passed, the library will execute the operation is a seperate transaction isolated only to that operation

txn1 := graph.DB.NewTransaction(true)
defer txn1.Discard()

graph.AddEdge("e", "f", txn1)
graph.RemoveEdge("a", "b", txn1)
a_n, _ = graph.GetEdges("a", txn1)
fmt.Println("Neighbors of a: ", a_n)

err := txn1.Commit()
if err!=nil {
  return err
}

About

No description or website provided.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages