Documentation ¶
Index ¶
- Constants
- type AsyncEdgeWriter
- type AsyncVertexWriter
- type JanusGraphEdgeWriter
- type JanusGraphProvider
- func (jgp *JanusGraphProvider) Close(ctx context.Context) error
- func (jgp *JanusGraphProvider) EdgeWriter(ctx context.Context, e edge.Builder, opts ...WriterOption) (AsyncEdgeWriter, error)
- func (jgp *JanusGraphProvider) HealthCheck(ctx context.Context) (bool, error)
- func (jgp *JanusGraphProvider) Name() string
- func (jgp *JanusGraphProvider) Prepare(ctx context.Context) error
- func (jgp *JanusGraphProvider) Raw() any
- func (jgp *JanusGraphProvider) VertexWriter(ctx context.Context, v vertex.Builder, c cache.CacheProvider, ...) (AsyncVertexWriter, error)
- type JanusGraphVertexWriter
- type Provider
- type WriterBase
- type WriterOption
Constants ¶
const (
StorageProviderName = "janusgraph"
)
const (
TracerServicename = "kubegraph"
)
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
type JanusGraphProvider ¶
type JanusGraphProvider struct {
// contains filtered or unexported fields
}
func NewGraphDriver ¶
func NewGraphDriver(ctx context.Context, cfg *config.KubehoundConfig) (*JanusGraphProvider, 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) Prepare ¶ added in v1.1.0
func (jgp *JanusGraphProvider) Prepare(ctx context.Context) error
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 ¶
func (jgp *JanusGraphProvider) VertexWriter(ctx context.Context, v vertex.Builder, c cache.CacheProvider, opts ...WriterOption) (AsyncVertexWriter, error)
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
type Provider ¶
type Provider interface { services.Dependency // Prepare wipes all data from the graph (usually to ensure a clean start) Prepare(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.
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