func (bdm *BoltDBManager) GetNodesObject() (NodesInterface, error) {
	conn, err := bdm.getConnectionForObject(ClassNameNodes)
	if err != nil {
		return nil, err
	}
	ns := Nodes{}
	ns.DB = conn
	return &ns, nil
}
returns Nodes Database structure. does al init
package database
import (
	"errors"
	"fmt"
	"os"
	"path"
	"strconv"
	"sync"
	"time"
	"github.com/boltdb/bolt"
	"github.com/gelembjuk/democoin/lib/utils"
)
const (
	ClassNameNodes                  = "nodes"
	ClassNameBlockchain             = "blockchain"
	ClassNameTransactions           = "transactions"
	ClassNameUnapprovedTransactions = "unapprovedtransactions"
	ClassNameUnspentOutputs         = "unspentoutputs"
)
type BoltDBManager struct {
	Logger     *utils.LoggerMan
	Config     DatabaseConfig
	connBC     *BoltDB
	connNodes  *BoltDB
	openedConn bool
	locker     *BoltDBLocker
	SessID     string
}
type BoltDBLocker struct {
	lockBC    *sync.Mutex
	lockNodes *sync.Mutex
}
func (bdm *BoltDBManager) GetLockerObject() DatabaseLocker {
	locker := &BoltDBLocker{}
	locker.lockBC = &sync.Mutex{}
	locker.lockNodes = &sync.Mutex{}
	return locker
}
func (bdm *BoltDBManager) SetLockerObject(lockerobj DatabaseLocker) {
	bdm.locker = lockerobj.(*BoltDBLocker)
}
func (bdm *BoltDBManager) SetConfig(config DatabaseConfig) error {
	bdm.Config = config
	return nil
}
func (bdm *BoltDBManager) SetLogger(logger *utils.LoggerMan) error {
	bdm.Logger = logger
	return nil
}
func (bdm *BoltDBManager) OpenConnection(reason string) error {
	if bdm.openedConn {
		return nil
	}
	bdm.openedConn = true
	bdm.connBC = nil
	bdm.connNodes = nil
	return nil
}
func (bdm *BoltDBManager) CloseConnection() error {
	if !bdm.openedConn {
		return nil
	}
	if bdm.connBC != nil {
		bdm.connBC.Close()
		bdm.unLockDB(bdm.connBC.lockFile)
		bdm.connBC = nil
	}
	if bdm.connNodes != nil {
		bdm.connNodes.Close()
		bdm.unLockDB(bdm.connNodes.lockFile)
		bdm.connNodes = nil
	}
	bdm.openedConn = false
	return nil
}
func (bdm *BoltDBManager) IsConnectionOpen() bool {
	return bdm.openedConn
}
func (bdm *BoltDBManager) InitDatabase() error {
	bdm.OpenConnection("InitBC")
	defer bdm.CloseConnection()
	_, err := bdm.getConnectionForObjectWithCheck(ClassNameBlockchain, true)
	if err != nil {
		return err
	}
	_, err = bdm.getConnectionForObjectWithCheck(ClassNameNodes, true)
	if err != nil {
		return err
	}
	bc, err := bdm.GetBlockchainObject()
	if err != nil {
		return err
	}
	err = bc.InitDB()
	if err != nil {
		return err
	}
	txs, err := bdm.GetTransactionsObject()
	if err != nil {
		return err
	}
	err = txs.InitDB()
	if err != nil {
		return err
	}
	utx, err := bdm.GetUnapprovedTransactionsObject()
	if err != nil {
		return err
	}
	err = utx.InitDB()
	if err != nil {
		return err
	}
	uos, err := bdm.GetUnspentOutputsObject()
	if err != nil {
		return err
	}
	err = uos.InitDB()
	if err != nil {
		return err
	}
	ns, err := bdm.GetNodesObject()
	if err != nil {
		return err
	}
	err = ns.InitDB()
	if err != nil {
		return err
	}
	return nil
}
func (bdm *BoltDBManager) CheckDBExists() (bool, error) {
	bc, err := bdm.GetBlockchainObject()
	if err != nil {
		return false, nil
	}
	tophash, err := bc.GetTopHash()
	if err != nil {
		return false, nil
	}
	if len(tophash) > 0 {
		return true, nil
	}
	return false, nil
}
func (bdm *BoltDBManager) GetBlockchainObject() (BlockchainInterface, error) {
	conn, err := bdm.getConnectionForObject(ClassNameBlockchain)
	if err != nil {
		return nil, err
	}
	bc := Blockchain{}
	bc.DB = conn
	return &bc, nil
}
func (bdm *BoltDBManager) GetTransactionsObject() (TranactionsInterface, error) {
	conn, err := bdm.getConnectionForObject(ClassNameTransactions)
	if err != nil {
		return nil, err
	}
	txs := Tranactions{}
	txs.DB = conn
	return &txs, nil
}
func (bdm *BoltDBManager) GetUnapprovedTransactionsObject() (UnapprovedTransactionsInterface, error) {
	conn, err := bdm.getConnectionForObject(ClassNameUnspentOutputs)
	if err != nil {
		return nil, err
	}
	uos := UnapprovedTransactions{}
	uos.DB = conn
	return &uos, nil
}
func (bdm *BoltDBManager) GetUnspentOutputsObject() (UnspentOutputsInterface, error) {
	conn, err := bdm.getConnectionForObject(ClassNameUnapprovedTransactions)
	if err != nil {
		return nil, err
	}
	uts := UnspentOutputs{}
	uts.DB = conn
	return &uts, nil
}