graphdb

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncEdgeWriter

type AsyncEdgeWriter interface {
	WriterBase

	// Queue add an edge model to an asynchronous write queue. Non-blocking.
	Queue(ctx context.Context, e any) error
}

AsyncEdgeWriter defines the interface for writer clients to queue aysnchronous, batched writes of edges to the graphdb.

type AsyncVertexWriter

type AsyncVertexWriter interface {
	WriterBase

	// Queue add a vertex model to an asynchronous write queue. Non-blocking.
	Queue(ctx context.Context, v any) error
}

AsyncVertexWriter defines the interface for writer clients to queue aysnchronous, batched writes of vertices to the graphdb.

type JanusGraphEdgeWriter

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

func NewJanusGraphAsyncEdgeWriter

func NewJanusGraphAsyncEdgeWriter(ctx context.Context, drc *gremlingo.DriverRemoteConnection,
	e edge.Builder, opts ...WriterOption) (*JanusGraphEdgeWriter, error)

NewJanusGraphAsyncEdgeWriter creates a new bulk edge writer instance.

func (*JanusGraphEdgeWriter) Close

func (jgv *JanusGraphEdgeWriter) Close(ctx context.Context) error

func (*JanusGraphEdgeWriter) Flush

func (jgv *JanusGraphEdgeWriter) Flush(ctx context.Context) error

Flush triggers writes of any remaining items in the queue. This is blocking

func (*JanusGraphEdgeWriter) Queue

func (jgv *JanusGraphEdgeWriter) Queue(ctx context.Context, v any) error

type JanusGraphProvider

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

func NewGraphDriver

func NewGraphDriver(ctx context.Context, dbHost string, timeout time.Duration) (*JanusGraphProvider, error)

func (*JanusGraphProvider) Clear

func (jgp *JanusGraphProvider) Clear(ctx context.Context) error

func (*JanusGraphProvider) Close

func (jgp *JanusGraphProvider) Close(ctx context.Context) error

Close cleans up any resources used by the Provider implementation. Provider cannot be reused after this call.

func (*JanusGraphProvider) EdgeWriter

func (jgp *JanusGraphProvider) EdgeWriter(ctx context.Context, e edge.Builder, opts ...WriterOption) (AsyncEdgeWriter, error)

EdgeWriter creates a new AsyncEdgeWriter instance to enable asynchronous bulk inserts of edges.

func (*JanusGraphProvider) HealthCheck

func (jgp *JanusGraphProvider) HealthCheck(ctx context.Context) (bool, error)

HealthCheck sends a single digit, as a string. JanusGraph will reply to this with the same value (arithmetic operation) We choose the value "1" because it's not the default int value in case there's an issue somewhere. from: https://stackoverflow.com/questions/59396980/gremlin-query-to-check-connection-health

func (*JanusGraphProvider) Name

func (jgp *JanusGraphProvider) Name() string

func (*JanusGraphProvider) Raw

func (jgp *JanusGraphProvider) Raw() any

Raw returns a handle to the underlying provider to allow implementation specific operations e.g graph queries.

func (*JanusGraphProvider) VertexWriter

VertexWriter creates a new AsyncVertexWriter instance to enable asynchronous bulk inserts of vertices.

type JanusGraphVertexWriter

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

func NewJanusGraphAsyncVertexWriter

func NewJanusGraphAsyncVertexWriter(ctx context.Context, drc *gremlin.DriverRemoteConnection,
	v vertex.Builder, c cache.CacheProvider, opts ...WriterOption) (*JanusGraphVertexWriter, error)

NewJanusGraphAsyncVertexWriter creates a new bulk vertex writer instance.

func (*JanusGraphVertexWriter) Close

func (jgv *JanusGraphVertexWriter) Close(ctx context.Context) error

func (*JanusGraphVertexWriter) Flush

func (jgv *JanusGraphVertexWriter) Flush(ctx context.Context) error

Flush triggers writes of any remaining items in the queue. This is blocking

func (*JanusGraphVertexWriter) Queue

func (jgv *JanusGraphVertexWriter) Queue(ctx context.Context, v any) error

type Provider

type Provider interface {
	services.Dependency

	// Clear wipes all data from the graph (usually to ensure a clean start)
	Clear(ctx context.Context) error

	// Raw returns a handle to the underlying provider to allow implementation specific operations e.g graph queries.
	Raw() any

	// VertexWriter creates a new AsyncVertexWriter instance to enable asynchronous bulk inserts of vertices.
	VertexWriter(ctx context.Context, v vertex.Builder, c cache.CacheProvider, opts ...WriterOption) (AsyncVertexWriter, error)

	// EdgeWriter creates a new AsyncEdgeWriter instance to enable asynchronous bulk inserts of edges.
	EdgeWriter(ctx context.Context, e edge.Builder, opts ...WriterOption) (AsyncEdgeWriter, error)

	// Close cleans up any resources used by the Provider implementation. Provider cannot be reused after this call.
	Close(ctx context.Context) error
}

Provider defines the interface for implementations of the graphdb provider for storage of the calculated K8s attack graph.

func Factory

func Factory(ctx context.Context, cfg *config.KubehoundConfig) (Provider, error)

Factory returns an initialized instance of a graphdb provider from the provided application config.

type WriterBase

type WriterBase interface {
	// Flush triggers writes of any remaining items in the queue. Blocks until operation completes.
	Flush(ctx context.Context) error

	// Close cleans up any resources used by the writer implementation. Writer cannot be reused after this call.
	Close(ctx context.Context) error
}

type WriterOption

type WriterOption func(*writerOptions)

func WithTags

func WithTags(tags []string) WriterOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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