db

package
v0.0.0-...-4ca2c20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDBNotInit = errors.New("database not initialize")

Functions

func AddFriend

func AddFriend(nodeID [32]byte, remark string)

Add new friend with associated info

func AddP2PMessageEvent

func AddP2PMessageEvent(sessionID [32]byte, event types.P2PMessageEvent)

Add appends p2p message event into session, creates session if not exists.

func DeleteFriend

func DeleteFriend(nodeID [32]byte)

func GetFriendIDs

func GetFriendIDs() [][32]byte

This returns non-nil value.

func GetFriends

func GetFriends() map[[32]byte]friendInfo

Get all friends info. Returns nil if any error occurs

func GetP2PSession

func GetP2PSession(sessionID [32]byte) *p2pSession

Get specific p2p session. Returns nil if any error occurs

func GetP2PSessions

func GetP2PSessions() []*p2pSession

Get all p2p sessions. Returns nil if any error occurs

func HasFriend

func HasFriend(nodeID [32]byte) bool

func Init

func Init(path string, localNodeID [32]byte)

Register leveldb database

func NotateP2PSession

func NotateP2PSession(sessionID [32]byte, userID enode.ID, pubkey *ecdsa.PublicKey)

func PutP2PSession

func PutP2PSession(sessionID [32]byte, session *p2pSession)

Types

type Database

type Database struct {
	*leveldb.DB
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL