Skip to content
Snippets Groups Projects
Commit ee41f8c4 authored by Hans Moog's avatar Hans Moog
Browse files

Feat: first compiling version of new ontologoies merge

parent 626a96dd
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,7 @@ require (
github.com/googollee/go-engine.io v1.4.3-0.20190924125625-798118fc0dd2
github.com/googollee/go-socket.io v1.4.3-0.20191204093753-683f8725b6d0
github.com/gorilla/websocket v1.4.1
github.com/iotaledger/hive.go v0.0.0-20200212114128-1460dba4a6b0
github.com/iotaledger/hive.go v0.0.0-20200217140357-8f1ea1f52085
github.com/iotaledger/iota.go v1.0.0-beta.14
github.com/labstack/echo v3.3.10+incompatible
github.com/labstack/gommon v0.3.0 // indirect
......
......@@ -4,6 +4,7 @@ import (
"container/list"
"time"
"github.com/dgraph-io/badger/v2"
"github.com/iotaledger/hive.go/types"
"github.com/iotaledger/goshimmer/packages/binary/storageprefix"
......@@ -37,13 +38,13 @@ type Tangle struct {
}
// Constructor for the tangle.
func New(storageId []byte) (result *Tangle) {
func New(badgerInstance *badger.DB, storageId []byte) (result *Tangle) {
result = &Tangle{
storageId: storageId,
transactionStorage: objectstorage.New(append(storageId, storageprefix.TangleTransaction...), transaction.FromStorage),
transactionMetadataStorage: objectstorage.New(append(storageId, storageprefix.TangleTransactionMetadata...), transactionmetadata.FromStorage),
approverStorage: objectstorage.New(append(storageId, storageprefix.TangleApprovers...), approver.FromStorage, objectstorage.PartitionKey(transaction.IdLength, transaction.IdLength)),
missingTransactionsStorage: objectstorage.New(append(storageId, storageprefix.TangleMissingTransaction...), missingtransaction.FromStorage),
transactionStorage: objectstorage.New(badgerInstance, append(storageId, storageprefix.TangleTransaction...), transaction.FromStorage),
transactionMetadataStorage: objectstorage.New(badgerInstance, append(storageId, storageprefix.TangleTransactionMetadata...), transactionmetadata.FromStorage),
approverStorage: objectstorage.New(badgerInstance, append(storageId, storageprefix.TangleApprovers...), approver.FromStorage, objectstorage.PartitionKey(transaction.IdLength, transaction.IdLength)),
missingTransactionsStorage: objectstorage.New(badgerInstance, append(storageId, storageprefix.TangleMissingTransaction...), missingtransaction.FromStorage),
Events: *newEvents(),
}
......
......@@ -5,16 +5,24 @@ import (
"testing"
"time"
"github.com/dgraph-io/badger/v2"
"github.com/iotaledger/hive.go/events"
"github.com/iotaledger/goshimmer/packages/binary/identity"
"github.com/iotaledger/goshimmer/packages/binary/tangle/model/transaction"
"github.com/iotaledger/goshimmer/packages/binary/tangle/model/transaction/payload/data"
"github.com/iotaledger/goshimmer/packages/binary/tangle/model/transactionmetadata"
"github.com/iotaledger/goshimmer/packages/database"
)
var testDatabase *badger.DB
func init() {
testDatabase = database.GetBadgerInstance()
}
func BenchmarkTangle_AttachTransaction(b *testing.B) {
tangle := New([]byte("TEST_BINARY_TANGLE"))
tangle := New(testDatabase, []byte("TEST_BINARY_TANGLE"))
if err := tangle.Prune(); err != nil {
b.Error(err)
......@@ -39,7 +47,7 @@ func BenchmarkTangle_AttachTransaction(b *testing.B) {
}
func TestTangle_AttachTransaction(t *testing.T) {
tangle := New([]byte("TEST_BINARY_TANGLE"))
tangle := New(testDatabase, []byte("TEST_BINARY_TANGLE"))
if err := tangle.Prune(); err != nil {
t.Error(err)
......
......@@ -4,6 +4,7 @@ import (
"github.com/iotaledger/hive.go/node"
)
// define the plugin as a placeholder, so the init methods get executed accordingly
var PLUGIN = node.NewPlugin("Config", node.Enabled, run)
func run(ctx *node.Plugin) {
......
......@@ -4,6 +4,7 @@ import (
"github.com/iotaledger/hive.go/node"
)
// define the plugin as a placeholder, so the init methods get executed accordingly
var PLUGIN = node.NewPlugin("Logger", node.Enabled, run)
func run(ctx *node.Plugin) {
......
......@@ -7,6 +7,7 @@ import (
"github.com/iotaledger/goshimmer/packages/binary/tangle/tipselector"
"github.com/iotaledger/goshimmer/packages/binary/tangle/transactionparser"
"github.com/iotaledger/goshimmer/packages/binary/tangle/transactionrequester"
"github.com/iotaledger/goshimmer/packages/database"
"github.com/iotaledger/goshimmer/packages/shutdown"
"github.com/iotaledger/hive.go/daemon"
"github.com/iotaledger/hive.go/events"
......@@ -36,7 +37,7 @@ func configure(*node.Plugin) {
TransactionParser = transactionparser.New()
TransactionRequester = transactionrequester.New()
TipSelector = tipselector.New()
Instance = tangle.New(storageprefix.Mainnet)
Instance = tangle.New(database.GetBadgerInstance(), storageprefix.Mainnet)
// setup TransactionParser
TransactionParser.Events.TransactionParsed.Attach(events.NewClosure(func(transaction *transaction.Transaction) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment