graphstore

package
v0.0.67 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0, NCSA Imports: 5 Imported by: 0

Documentation

Overview

Package graphstore defines the Service and Sharded interfaces, and provides some useful utility functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatchWrites

func BatchWrites(entries <-chan *spb.Entry, maxSize int) <-chan *spb.WriteRequest

BatchWrites returns a channel of WriteRequests for the given entries. Consecutive entries with the same Source will be collected in the same WriteRequest, with each request containing up to maxSize updates.

func EntryMatchesScan

func EntryMatchesScan(req *spb.ScanRequest, entry *spb.Entry) bool

EntryMatchesScan reports whether entry belongs in the result set for req.

func IsEdge added in v0.0.9

func IsEdge(e *spb.Entry) bool

IsEdge determines if the Entry describes an edge; implies !IsNodeFact(e).

func IsNodeFact added in v0.0.9

func IsNodeFact(e *spb.Entry) bool

IsNodeFact determines if the Entry is a node fact; implies !IsEdge(e).

func ValidEntry added in v0.0.9

func ValidEntry(e *spb.Entry) error

ValidEntry determines if the given Entry is correctly constructed.

Types

type EntryFunc

type EntryFunc func(*spb.Entry) error

An EntryFunc is a callback from the implementation of a Service to deliver entry messages. If the callback returns an error, the operation stops. If the error is io.EOF, the operation returns nil; otherwise it returns the error value from the callback.

type Service

type Service interface {
	// Read calls f with each entry having the ReadRequest's given source
	// VName, subject to the following rules:
	//
	//  |----------+---------------------------------------------------------|
	//  | EdgeKind | Result                                                  |
	//  |----------+---------------------------------------------------------|
	//  | ø        | All entries with kind and target empty (node entries).  |
	//  | "*"      | All entries (node and edge, regardless of kind/target). |
	//  | "kind"   | All edge entries with the given edge kind.              |
	//  |----------+---------------------------------------------------------|
	//
	// Read returns when there are no more entries to send. The Read operation should be
	// implemented with time complexity proportional to the size of the return set.
	Read(ctx context.Context, req *spb.ReadRequest, f EntryFunc) error

	// Scan calls f with each entries having the specified target VName, kind,
	// and fact label prefix. If a field is empty, any entry value for that
	// field matches and will be returned. Scan returns when there are no more
	// entries to send. Scan is similar to Read, but with no time complexity
	// restrictions.
	Scan(ctx context.Context, req *spb.ScanRequest, f EntryFunc) error

	// Write atomically inserts or updates a collection of entries into the store.
	// Each update is a tuple of the form (kind, target, fact, value). For each such
	// update, an entry (source, kind, target, fact, value) is written into the store,
	// replacing any existing entry (source, kind, target, fact, value') that may
	// exist. Note that this operation cannot delete any data from the store; entries are
	// only ever inserted or updated. Apart from acting atomically, no other constraints
	// are placed on the implementation.
	Write(ctx context.Context, req *spb.WriteRequest) error

	// Close and release any underlying resources used by the store.
	// No operations may be used on the store after this has been called.
	Close(ctx context.Context) error
}

Service refers to an open Kythe graph store.

type Sharded

type Sharded interface {
	Service

	// Count returns the number of entries in the given shard.
	Count(ctx context.Context, req *spb.CountRequest) (int64, error)

	// Shard calls f with each entry in the given shard.
	Shard(ctx context.Context, req *spb.ShardRequest, f EntryFunc) error
}

Sharded represents a store that can be arbitrarily sharded for parallel processing. Depending on the implementation, these methods may not return consistent results when the store is being written to. Shards are indexed from 0.

Directories

Path Synopsis
Package proxy defines a proxy graphstore.Service that delegates requests to other service implementations.
Package proxy defines a proxy graphstore.Service that delegates requests to other service implementations.

Jump to

Keyboard shortcuts

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