-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Conversation
graph/quadstore.go
Outdated
@@ -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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
graph/kv/quadstore.go
Outdated
@@ -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 |
There was a problem hiding this comment.
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.
graph/quadstore.go
Outdated
@@ -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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func NamesOf(ctx context.Context, qs QuadStore, nodes []quad.Value) ([]Value, error) { | |
func RefsOf(ctx context.Context, qs QuadStore, nodes []quad.Value) ([]Value, error) { |
297f6ca
to
54d8874
Compare
Implement for kv/QuadStore to avoid breaking it's BatchQuadStore implementation.
54d8874
to
b378435
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks :)
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.