update

package
v0.0.0-...-6719cd2 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package update handles requests to modify the graph.

Note: this package currently only handles Insert, but lots of things are called Update so that they can be generalized to handle Delete and combined Delete+Insert requests later.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Insert

func Insert(ctx context.Context, req *api.InsertRequest,
	recentIdx blog.Index, store Store, aLog ALog,
) (*api.InsertResult, error)

Insert handles an api.InsertRequest. recentIdx is a recent log index used to read the supporting data in the initial attempt; if recentIdx is too stale, Insert will waste some effort.

func ResolveExternalIDs

func ResolveExternalIDs(ctx context.Context, store lookups.PO,
	index blog.Index, externalIDs []string,
) (map[string]uint64, error)

ResolveExternalIDs looks up a KID for each given external ID. It executes all the lookups at the given index. It returns an error if unable to complete the lookups. Otherwise, every string in 'externalIDs' becomes as a key in the returned map; the value is a corresponding KID if found or 0 otherwise.

This is public because it might be useful elsewhere. TODO: Perhaps it should move into viewclient.

Types

type ALog

type ALog interface {
	AppendSingle(ctx context.Context, data []byte) (blog.Index, error)
}

ALog is the subset of blog.AkutanLog that updates need. This makes it easier to write unit tests.

type Store

type Store interface {
	lookups.PO  // to look up external IDs
	lookups.SPO // to look up existing facts
}

Store is the subset of lookups.All that updates need. This makes it easier to write unit tests.

Directories

Path Synopsis
Package conv helps convert between related types as an update request is processed.
Package conv helps convert between related types as an update request is processed.

Jump to

Keyboard shortcuts

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