server

package
v0.0.0-...-904a6b0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2025 License: MIT Imports: 50 Imported by: 0

Documentation

Overview

Package server contains code for serving the Grip API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlattenRewriter

func FlattenRewriter(_ context.Context, response proto.Message) (interface{}, error)

func NewMarshaler

func NewMarshaler() runtime.Marshaler

func StartDriver

func StartDriver(d config.DriverConfig, sources map[string]gripper.GRIPSourceClient) (gdbi.GraphDB, error)

StartDriver: based on string entry in config file, figure out which driver to initialize

Types

type EndpointSetupFunc

type EndpointSetupFunc func(client gripql.Client, config map[string]string) (http.Handler, error)

type GripServer

GripServer is a GRPC based grip server

func NewGripServer

func NewGripServer(conf *config.Config, baseDir string, drivers map[string]gdbi.GraphDB) (*GripServer, error)

NewGripServer initializes a GRPC server to connect to the graph store

func (*GripServer) AddEdge

func (server *GripServer) AddEdge(ctx context.Context, elem *gripql.GraphElement) (*gripql.EditResult, error)

AddEdge adds an edge to the graph

func (*GripServer) AddEndpoint

func (server *GripServer) AddEndpoint(name string, path string, config map[string]string) error

func (*GripServer) AddGraph

func (server *GripServer) AddGraph(ctx context.Context, elem *gripql.GraphID) (*gripql.EditResult, error)

AddGraph creates a new graph on the server

func (*GripServer) AddIndex

func (server *GripServer) AddIndex(ctx context.Context, idx *gripql.IndexID) (*gripql.EditResult, error)

AddIndex adds a new index

func (*GripServer) AddJsonSchema

func (server *GripServer) AddJsonSchema(ctx context.Context, rawjson *gripql.RawJson) (*gripql.EditResult, error)

AddJsonSchema adds a jsonschema to grip as a graph

func (*GripServer) AddMapping

func (server *GripServer) AddMapping(ctx context.Context, req *gripql.Graph) (*gripql.EditResult, error)

AddMapping caches a graph schema on the server

func (*GripServer) AddSchema

func (server *GripServer) AddSchema(ctx context.Context, req *gripql.Graph) (*gripql.EditResult, error)

AddSchema caches a graph schema on the server

func (*GripServer) AddVertex

func (server *GripServer) AddVertex(ctx context.Context, elem *gripql.GraphElement) (*gripql.EditResult, error)

AddVertex adds a vertex to the graph

func (*GripServer) BulkAdd

func (server *GripServer) BulkAdd(stream gripql.Edit_BulkAddServer) error

func (*GripServer) BulkAddRaw

func (server *GripServer) BulkAddRaw(stream gripql.Edit_BulkAddRawServer) error

func (*GripServer) BulkDelete

func (server *GripServer) BulkDelete(ctx context.Context, delete *gripql.DeleteData) (*gripql.EditResult, error)

func (*GripServer) ClosePlugins

func (server *GripServer) ClosePlugins()

func (*GripServer) DeleteEdge

func (server *GripServer) DeleteEdge(ctx context.Context, elem *gripql.ElementID) (*gripql.EditResult, error)

DeleteEdge deletes an edge from the graph server

func (*GripServer) DeleteGraph

func (server *GripServer) DeleteGraph(ctx context.Context, elem *gripql.GraphID) (*gripql.EditResult, error)

DeleteGraph deletes a graph

func (*GripServer) DeleteIndex

func (server *GripServer) DeleteIndex(ctx context.Context, idx *gripql.IndexID) (*gripql.EditResult, error)

DeleteIndex removes an index from the server

func (*GripServer) DeleteJob

func (server *GripServer) DeleteJob(ctx context.Context, job *gripql.QueryJob) (*gripql.JobStatus, error)

func (*GripServer) DeleteVertex

func (server *GripServer) DeleteVertex(ctx context.Context, elem *gripql.ElementID) (*gripql.EditResult, error)

DeleteVertex deletes a vertex from the server

func (*GripServer) GetEdge

func (server *GripServer) GetEdge(ctx context.Context, elem *gripql.ElementID) (*gripql.Edge, error)

GetEdge returns an edge given a gripql.Element

func (*GripServer) GetJob

func (server *GripServer) GetJob(ctx context.Context, job *gripql.QueryJob) (*gripql.JobStatus, error)

func (*GripServer) GetMapping

func (server *GripServer) GetMapping(ctx context.Context, elem *gripql.GraphID) (*gripql.Graph, error)

GetMapping returns the schema of a specific graph in the database

func (*GripServer) GetSchema

func (server *GripServer) GetSchema(ctx context.Context, elem *gripql.GraphID) (*gripql.Graph, error)

GetSchema returns the schema of a specific graph in the database

func (*GripServer) GetTimestamp

func (server *GripServer) GetTimestamp(ctx context.Context, elem *gripql.GraphID) (*gripql.Timestamp, error)

GetTimestamp returns the update timestamp of a graph

func (*GripServer) GetVertex

func (server *GripServer) GetVertex(ctx context.Context, elem *gripql.ElementID) (*gripql.Vertex, error)

GetVertex returns a vertex given a gripql.Element

func (*GripServer) ListDrivers

func (*GripServer) ListGraphs

func (server *GripServer) ListGraphs(ctx context.Context, empty *gripql.Empty) (*gripql.ListGraphsResponse, error)

ListGraphs returns a list of graphs managed by the driver

func (*GripServer) ListIndices

func (server *GripServer) ListIndices(ctx context.Context, idx *gripql.GraphID) (*gripql.ListIndicesResponse, error)

ListIndices lists avalible indices from a graph

func (*GripServer) ListJobs

func (server *GripServer) ListJobs(graph *gripql.GraphID, srv gripql.Job_ListJobsServer) error

func (*GripServer) ListLabels

func (server *GripServer) ListLabels(ctx context.Context, idx *gripql.GraphID) (*gripql.ListLabelsResponse, error)

ListLabels lists the vertex and edge labels in a graph

func (*GripServer) ListPlugins

func (*GripServer) ListTables

func (server *GripServer) ListTables(empty *gripql.Empty, srv gripql.Query_ListTablesServer) error

ListTables returns list of all tables that are found in plugin system

func (*GripServer) LoadSchemas

func (server *GripServer) LoadSchemas(sch *gripql.Graph, out *graph.GraphSchema) (*graph.GraphSchema, error)

func (*GripServer) ResumeJob

func (server *GripServer) ResumeJob(query *gripql.ExtendQuery, srv gripql.Job_ResumeJobServer) error

func (*GripServer) SampleSchema

func (server *GripServer) SampleSchema(ctx context.Context, elem *gripql.GraphID) (*gripql.Graph, error)

GetSchema returns the schema of a specific graph in the database

func (*GripServer) SearchJobs

func (server *GripServer) SearchJobs(query *gripql.GraphQuery, srv gripql.Job_SearchJobsServer) error

func (*GripServer) Serve

func (server *GripServer) Serve(pctx context.Context) error

Serve starts the server and does not block. This will open TCP ports for both RPC and HTTP.

func (*GripServer) StartPlugin

func (server *GripServer) StartPlugin(ctx context.Context, config *gripql.PluginConfig) (*gripql.PluginStatus, error)

func (*GripServer) Submit

func (server *GripServer) Submit(ctx context.Context, query *gripql.GraphQuery) (*gripql.QueryJob, error)

func (*GripServer) Traversal

func (server *GripServer) Traversal(query *gripql.GraphQuery, queryServer gripql.Query_TraversalServer) error

Traversal parses a traversal request and streams the results back

func (*GripServer) ViewJob

func (server *GripServer) ViewJob(job *gripql.QueryJob, srv gripql.Job_ViewJobServer) error

type MarshalClean

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

MarshalClean is a shim class to 'fix' outgoing streamed messages in the default implementation, grpc-gateway wraps the individual messages of the stream with a {"result" : <value>}. The cleaner idendifies that and removes the wrapper

func (*MarshalClean) ContentType

func (mclean *MarshalClean) ContentType(i interface{}) string

ContentType return content type of marshler

func (*MarshalClean) Marshal

func (mclean *MarshalClean) Marshal(v interface{}) ([]byte, error)

Marshal serializes v into a JSON encoded byte array. If v is of type `proto.Message` the then field "result" is extracted and returned by itself. This is mainly to get around a weird behavior of the GRPC gateway streaming output

func (*MarshalClean) NewDecoder

func (mclean *MarshalClean) NewDecoder(r io.Reader) runtime.Decoder

NewDecoder shims runtime.Marshaler.NewDecoder

func (*MarshalClean) NewEncoder

func (mclean *MarshalClean) NewEncoder(w io.Writer) runtime.Encoder

NewEncoder shims runtime.Marshaler.NewEncoder

func (*MarshalClean) Unmarshal

func (mclean *MarshalClean) Unmarshal(data []byte, v interface{}) error

Unmarshal shims runtime.Marshaler.Unmarshal

type Plugin

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

Jump to

Keyboard shortcuts

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