Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NamesOf to the BatchQuadStore interface #742

Merged
merged 1 commit into from
Oct 20, 2018

Conversation

phyrwork
Copy link
Contributor

Requirement exposed by #741

Add NamesOf to the BatchQuadStore interface.

Add notes that NamesOf and ValuesOf have their names the wrong
way around.

Add a dummy NamesOf to kv/QuadStore to avoid breaking it's
BatchQuadStore implementation.

@phyrwork phyrwork requested a review from dennwc as a code owner October 18, 2018 15:54
@@ -31,7 +31,8 @@ import (
)

type BatchQuadStore interface {
ValuesOf(ctx context.Context, vals []Value) ([]quad.Value, error)
ValuesOf(ctx context.Context, vals []Value) ([]quad.Value, error) // TODO: Should be called NamesOf()
NamesOf(ctx context.Context, nodes []quad.Value) ([]Value, error) // TODO: Should be called ValuesOf()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NamesOf(ctx context.Context, nodes []quad.Value) ([]Value, error) // TODO: Should be called ValuesOf()
RefsOf(ctx context.Context, nodes []quad.Value) ([]Value, error) // TODO: Should be called ValuesOf()

And the ValuesOf above is fine. This is a legacy from an old version of Cayley. NameOf and ValueOf will be removed in v0.8.

@@ -272,6 +272,16 @@ func (qs *QuadStore) ValuesOf(ctx context.Context, vals []graph.Value) ([]quad.V
}
return out, last
}

// TODO: Proper BatchQuadStore support for this function
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I ask you to implement it at least partially? :)

Check the ValueOf, an algorithm is quite simple: open View once, iterate over values inside, call resolveQuadValue for each and store the result. But instead of dropping an error as ValueOf does, return it here.

@@ -45,6 +46,17 @@ func ValuesOf(ctx context.Context, qs QuadStore, vals []Value) ([]quad.Value, er
return out, nil
}

func NamesOf(ctx context.Context, qs QuadStore, nodes []quad.Value) ([]Value, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func NamesOf(ctx context.Context, qs QuadStore, nodes []quad.Value) ([]Value, error) {
func RefsOf(ctx context.Context, qs QuadStore, nodes []quad.Value) ([]Value, error) {

@dennwc dennwc added this to the v0.7.5 milestone Oct 18, 2018
Implement for kv/QuadStore to avoid breaking it's BatchQuadStore
implementation.
Copy link
Member

@dennwc dennwc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks :)

@dennwc dennwc merged commit 14279cc into cayleygraph:master Oct 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants