gobolt

package module
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2019 License: Apache-2.0 Imports: 15 Imported by: 13

README

neo4j-go-connector

This package is an internal dependency being used by Neo4j Go Driver.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllocationStats

func GetAllocationStats() (int64, int64, int64)

GetAllocationStats returns statistics about seabolt (C) allocations

func IsAuthenticationError

func IsAuthenticationError(err error) bool

func IsClientError

func IsClientError(err error) bool

func IsConnectorError

func IsConnectorError(err error) bool

IsConnectorError checkes whether given err is a ConnectorError

func IsDatabaseError

func IsDatabaseError(err error) bool

IsDatabaseError checkes whether given err is a DatabaseError

func IsGenericError

func IsGenericError(err error) bool

IsGenericError checkes whether given err is a GenericError

func IsSecurityError

func IsSecurityError(err error) bool

func IsServiceUnavailable

func IsServiceUnavailable(err error) bool

IsServiceUnavailable checkes whether given err represents a service unavailable status

func IsSessionExpired

func IsSessionExpired(err error) bool

func IsTransientError

func IsTransientError(err error) bool

IsTransientError checks whether given err is a transient error

func IsWriteError

func IsWriteError(err error) bool

IsWriteError checks whether given err can be classified as a write error

Types

type AccessMode

type AccessMode int

AccessMode is used by the routing driver to decide if a transaction should be routed to a write server or a read server in a cluster. When running a transaction, a write transaction requires a server that supports writes. A read transaction, on the other hand, requires a server that supports read operations. This classification is key for routing driver to route transactions to a cluster correctly.

const (
	// AccessModeWrite makes the driver return a session towards a write server
	AccessModeWrite AccessMode = 0
	// AccessModeRead makes the driver return a session towards a follower or a read-replica
	AccessModeRead AccessMode = 1
)

type BoltError

type BoltError interface {
	BoltError() bool
}

BoltError is a marker interface to identify neo4j errors

type Config

type Config struct {
	Encryption             bool
	TLSCertificates        []*x509.Certificate
	TLSSkipVerify          bool
	TLSSkipVerifyHostname  bool
	MaxPoolSize            int
	MaxConnLifetime        time.Duration
	ConnAcquisitionTimeout time.Duration
	SockConnectTimeout     time.Duration
	SockKeepalive          bool
	ConnectorErrorFactory  func(state, code int, codeText, context, description string) ConnectorError
	DatabaseErrorFactory   func(classification, code, message string) DatabaseError
	GenericErrorFactory    func(format string, args ...interface{}) GenericError
	Log                    Logging
	AddressResolver        URLAddressResolver
	ValueHandlers          []ValueHandler
}

Config holds the available configurations options applicable to the connector

type Connection

type Connection interface {
	Id() (string, error)
	RemoteAddress() (string, error)
	Server() (string, error)

	Begin(bookmarks []string, txTimeout time.Duration, txMetadata map[string]interface{}) (RequestHandle, error)
	Commit() (RequestHandle, error)
	Rollback() (RequestHandle, error)
	Run(cypher string, parameters map[string]interface{}, bookmarks []string, txTimeout time.Duration, txMetadata map[string]interface{}) (RequestHandle, error)
	PullAll() (RequestHandle, error)
	DiscardAll() (RequestHandle, error)
	Reset() (RequestHandle, error)
	Flush() error
	Fetch(request RequestHandle) (FetchType, error)  // return type ?
	FetchSummary(request RequestHandle) (int, error) // return type ?

	LastBookmark() (string, error)
	Fields() ([]string, error)
	Metadata() (map[string]interface{}, error)
	Data() ([]interface{}, error)

	Close() error
}

Connection represents an active seabolt connection

type Connector

type Connector interface {
	Acquire(mode AccessMode) (Connection, error)
	Close() error
}

Connector represents an initialised seabolt connector

func NewConnector

func NewConnector(uri *url.URL, authToken map[string]interface{}, config *Config) (Connector, error)

type ConnectorError

type ConnectorError interface {
	// State returns the state of the related connection
	State() int
	// Code returns the error code set on the related connection
	Code() int
	// Context returns the error context set by the connector
	Context() string
	// Description returns any additional description set
	Description() string
	// Error returns textual representation of the connector level error
	Error() string
}

ConnectorError represents errors that occur on the connector/client side, like network errors, etc.

type DatabaseError

type DatabaseError interface {
	// Classification returns classification of the error returned from the database
	Classification() string
	// Code returns code of the error returned from the database
	Code() string
	// Message returns message of the error returned from the database
	Message() string
	// Error returns textual representation of the error returned from the database
	Error() string
}

DatabaseError represents errors returned from the server a FAILURE messages

type FetchType

type FetchType int

FetchType identifies the type of the result fetched via Fetch() call

const (
	// FetchTypeRecord tells that fetched data is record
	FetchTypeRecord FetchType = 1
	// FetchTypeMetadata tells that fetched data is metadata
	FetchTypeMetadata FetchType = 0
	// FetchTypeError tells that fetch was not successful
	FetchTypeError FetchType = -1
)

type GenericError

type GenericError interface {
	// Message returns the underlying error message
	Message() string
	// Error returns textual representation of the generic error
	Error() string
}

GenericError represents errors which originates from the connector wrapper itself

type Logging

type Logging interface {
	ErrorEnabled() bool
	WarningEnabled() bool
	InfoEnabled() bool
	DebugEnabled() bool

	Errorf(message string, args ...interface{})
	Warningf(message string, args ...interface{})
	Infof(message string, args ...interface{})
	Debugf(message string, args ...interface{})
}

Logging is the interface that any provided logging target must satisfy for the connector to use

type RequestHandle

type RequestHandle int64

RequestHandle identifies an individual request sent to server

type URLAddressResolver

type URLAddressResolver func(address *url.URL) []*url.URL

URLAddressResolver is the callback function signature that provided custom resolver should adhere to

type ValueHandler

type ValueHandler interface {
	ReadableStructs() []int16
	WritableTypes() []reflect.Type
	Read(signature int16, values []interface{}) (interface{}, error)
	Write(value interface{}) (int16, []interface{}, error)
}

ValueHandler is the interface that custom value handlers should implement to support reading/writing struct types into custom types

type ValueHandlerError

type ValueHandlerError struct {
	// contains filtered or unexported fields
}

ValueHandlerError is the special error that ValueHandlers should return in case of unexpected cases

func NewValueHandlerError

func NewValueHandlerError(format string, args ...interface{}) *ValueHandlerError

NewValueHandlerError constructs a new ValueHandlerError

func (*ValueHandlerError) Error

func (ns *ValueHandlerError) Error() string

Error returns textual representation of the value handler error

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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