Documentation ¶
Overview ¶
Package viewclient provides functionality for querying view servers.
Index ¶
- type CarouselClient
- type CarouselClients
- type CarouselConsumer
- type Client
- func (c *Client) CarouselViews(pred ViewInfoPredicate) CarouselClients
- func (c *Client) Close()
- func (c *Client) DiagnosticsViews() []*DiagnosticsClient
- func (c *Client) FactStats(ctx context.Context, overallReq *rpc.FactStatsRequest) (*FactStats, error)
- func (c *Client) LogStatus(ctx context.Context, clients CarouselClients) (*LogStatusResult, error)
- func (c *Client) LookupPO(ctx context.Context, req *rpcdef.LookupPORequest, ...) error
- func (c *Client) LookupPOCmp(ctx context.Context, req *rpcdef.LookupPOCmpRequest, ...) error
- func (c *Client) LookupS(ctx context.Context, req *rpcdef.LookupSRequest, ...) error
- func (c *Client) LookupSP(ctx context.Context, req *rpcdef.LookupSPRequest, ...) error
- func (c *Client) LookupSPO(ctx context.Context, req *rpcdef.LookupSPORequest, ...) error
- func (c *Client) ReadFactsPOViews() ReadFactsPOClients
- func (c *Client) ReadFactsSPViews() ReadFactsSPClients
- func (c *Client) RideCarousel(ctx context.Context, req *rpc.CarouselRequest, viewPred ViewInfoPredicate) (CarouselConsumer, error)
- func (c *Client) Stats(ctx context.Context) []ViewStats
- func (c *Client) UpdateStats(ctx context.Context) error
- type DiagnosticsClient
- type FactStats
- func (stats *FactStats) BytesPerFact() int
- func (stats *FactStats) NumFacts() int
- func (stats *FactStats) NumFactsO(object rpc.KGObject) int
- func (stats *FactStats) NumFactsP(predicate uint64) int
- func (stats *FactStats) NumFactsPO(predicate uint64, object rpc.KGObject) int
- func (stats *FactStats) NumFactsS(subject uint64) int
- func (stats *FactStats) NumFactsSO(subject uint64, object rpc.KGObject) int
- func (stats *FactStats) NumFactsSP(subject uint64, predicate uint64) int
- func (stats *FactStats) ToRPCFactStats() *rpc.FactStatsResult
- type LogStatusResult
- func (r *LogStatusResult) LastApplied() (blog.Index, error)
- func (r *LogStatusResult) NextPositionInSpace(enc rpc.FactKeyEncoding, covering space.Range) (rpc.LogPosition, error)
- func (r *LogStatusResult) ReplayPosition() (rpc.LogPosition, error)
- func (r *LogStatusResult) ReplayPositionInSpace(enc rpc.FactKeyEncoding, covering space.Range) (rpc.LogPosition, error)
- func (r *LogStatusResult) Results() ([]*rpc.LogStatusResult, []error)
- type ReadFactsPOClient
- type ReadFactsPOClients
- type ReadFactsSPClient
- type ReadFactsSPClients
- type StreamingConvention
- type ViewInfoPredicate
- type ViewStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CarouselClient ¶
type CarouselClient struct { View viewreg.View Stub rpc.CarouselClient }
CarouselClient is a client for the Carousel service running on the particular view instance
func (*CarouselClient) Serves ¶
func (c *CarouselClient) Serves() space.Range
Serves returns the Range in the HashSpace that this view contains.
func (*CarouselClient) String ¶
func (c *CarouselClient) String() string
type CarouselClients ¶
type CarouselClients []*CarouselClient
CarouselClients is a collection of CarouselClient, you typically get one of these from the Client.CarouselViews() method.
func (CarouselClients) Len ¶
func (c CarouselClients) Len() int
Len returns the number of clients in this list. This is part of the implementation of the fanout.Views interface
type CarouselConsumer ¶
type CarouselConsumer interface { ReplayPosition() rpc.LogPosition DataCh() <-chan *rpc.CarouselResult ErrorsCh() <-chan error Stop() }
CarouselConsumer provides ways for a client of a carousel request to consume the resulting data
type Client ¶
Client is a compatibility layer around the newer viewreg.Registry. Client currently owns its Registry, but in the future we plan for the current users of Client to manage their own Registry.
TODO: meh viewclient.Client
func NewWithLocator ¶
NewWithLocator constructs a Client that finds view instances from the given Locator.
func (*Client) CarouselViews ¶
func (c *Client) CarouselViews(pred ViewInfoPredicate) CarouselClients
CarouselViews returns all views that support the Carousel feature, if pred is non-nil only those views passing the view predicate are included
func (*Client) Close ¶
func (c *Client) Close()
Close shuts down the view registry, disconnecting from all the views. After this, the Client is no longer useful, as it will not initiate new connections. Close() is safe to call more than once.
func (*Client) DiagnosticsViews ¶
func (c *Client) DiagnosticsViews() []*DiagnosticsClient
DiagnosticsViews returns all views that support the Diagnostics feature.
func (*Client) FactStats ¶
func (c *Client) FactStats(ctx context.Context, overallReq *rpc.FactStatsRequest) (*FactStats, error)
FactStats collects data about the distributions of facts in the store. It fans out to many view servers, which have this data readily available, and collects it all together.
func (*Client) LogStatus ¶
func (c *Client) LogStatus(ctx context.Context, clients CarouselClients) (*LogStatusResult, error)
LogStatus will call LogStatus on each of the supplied client views, and aggregate the results into an all clients wide view. For each normalized partition it collects the most recent atIndex and the oldest replay index then takes the overall min of each for an overall view.
func (*Client) LookupPO ¶
func (c *Client) LookupPO(ctx context.Context, req *rpcdef.LookupPORequest, resCh chan *rpcdef.LookupChunk) error
LookupPO calls out to views and collects all facts that match the given predicate-objects. LookupPO produces facts in an undefined order, but it guarantees the facts are distinct (it filters duplicate facts caused by RPC hedging and errors). The returned facts have their fields fully populated. See StreamingConvention for how to call LookupPO.
func (*Client) LookupPOCmp ¶
func (c *Client) LookupPOCmp(ctx context.Context, req *rpcdef.LookupPOCmpRequest, resCh chan *rpcdef.LookupChunk) error
LookupPOCmp calls out to views and collects all facts that match the given predicate and the given object criteria. LookupPOCmp produces facts in an undefined order, but it guarantees the facts are distinct (it filters duplicate facts caused by RPC hedging and errors). The returned facts have their fields fully populated. See StreamingConvention for how to call LookupPOcmp.
func (*Client) LookupS ¶
func (c *Client) LookupS(ctx context.Context, req *rpcdef.LookupSRequest, resCh chan *rpcdef.LookupChunk) error
LookupS calls out to views and collects all facts that match the given subjects. LookupS produces facts in an undefined order, but it guarantees the facts are distinct (it filters duplicate facts caused by RPC hedging and errors). The returned facts have their fields fully populated. See StreamingConvention for how to call LookupS.
func (*Client) LookupSP ¶
func (c *Client) LookupSP(ctx context.Context, req *rpcdef.LookupSPRequest, resCh chan *rpcdef.LookupChunk) error
LookupSP calls out to views and collects all facts that match the given subject-predicates. LookupSP produces facts in an undefined order, but it guarantees the facts are distinct (it filters duplicate facts caused byRPC hedging and errors). The returned facts have their fields fully populated. See StreamingConvention for how to call LookupSP.
func (*Client) LookupSPO ¶
func (c *Client) LookupSPO(ctx context.Context, req *rpcdef.LookupSPORequest, resCh chan *rpcdef.LookupChunk) error
LookupSPO calls out to views and collects all facts that match the given subject-predicate-objects. LookupSPO produces facts in an undefined order, but it guarantees the facts are distinct (it filters duplicate facts caused by RPC hedging and errors). The returned facts have their fields fully populated. See StreamingConvention for how to call LookupSP.
func (*Client) ReadFactsPOViews ¶
func (c *Client) ReadFactsPOViews() ReadFactsPOClients
ReadFactsPOViews returns all views that support the ReadFactsPO feature.
func (*Client) ReadFactsSPViews ¶
func (c *Client) ReadFactsSPViews() ReadFactsSPClients
ReadFactsSPViews returns all views that support the ReadFactsSP feature.
func (*Client) RideCarousel ¶
func (c *Client) RideCarousel(ctx context.Context, req *rpc.CarouselRequest, viewPred ViewInfoPredicate) (CarouselConsumer, error)
RideCarousel will start a carousel client, fanning out the carousel request to the relevant source views. This will check with the views to find the most recent index where there are no pending transactions and start the carousel from that.
if viewPred is not empty, then only views that pass this predicate will be included. For efficiency this will try to select views that use the same key encoding as the request, as that can reduce the number of views needed to fetch data from (because we can safely rule out that some view won't have any relevant data). However if needed it will fallback to Carouselling across the entire key space of an alternative key encoding.
func (*Client) Stats ¶
Stats makes a best effort attempt to collect general service statistics from all views that expose them. For each view consulted there will be an entry in the returned slice.
func (*Client) UpdateStats ¶
UpdateStats asks all the views to start recalculating their fact statistics if an error is encountered from one or more the views, it is returned, however that does not stop this trying to trigger the update on the remaining views.
type DiagnosticsClient ¶
type DiagnosticsClient struct { View viewreg.View Stub rpc.DiagnosticsClient }
DiagnosticsClient is a client for the Diagnostic service running on the particular view instance
func (*DiagnosticsClient) String ¶
func (c *DiagnosticsClient) String() string
type FactStats ¶
type FactStats struct {
// contains filtered or unexported fields
}
FactStats contains statistics about how facts are distributed in the overall database.
func (*FactStats) BytesPerFact ¶
BytesPerFact Implements planner.Stats.BytesPerFact().
func (*FactStats) NumFactsPO ¶
NumFactsPO Implements planner.Stats.NumFactsPO().
func (*FactStats) NumFactsSO ¶
NumFactsSO Implements planner.Stats.NumFactsSO().
func (*FactStats) NumFactsSP ¶
NumFactsSP Implements planner.Stats.NumFactsSP().
func (*FactStats) ToRPCFactStats ¶
func (stats *FactStats) ToRPCFactStats() *rpc.FactStatsResult
ToRPCFactStats will generate an rpc fact stats result from FactStats.
type LogStatusResult ¶
type LogStatusResult struct {
// contains filtered or unexported fields
}
LogStatusResult contains the calculated aggregate result of calling LogStatus on a set of views
func (*LogStatusResult) LastApplied ¶
func (r *LogStatusResult) LastApplied() (blog.Index, error)
LastApplied will return the log index that all views have applied across the space range of all the encodings. If there are points not covered, it'll return an error.
func (*LogStatusResult) NextPositionInSpace ¶
func (r *LogStatusResult) NextPositionInSpace(enc rpc.FactKeyEncoding, covering space.Range) (rpc.LogPosition, error)
NextPositionInSpace will take the highest next position from all the views covering a partition, and then return the smallest of those across all the partition that cover the 'covering' range. At least one view in every relevant partition is at the returned index. If there are points in the requested range that have no coverage an error is returned.
func (*LogStatusResult) ReplayPosition ¶
func (r *LogStatusResult) ReplayPosition() (rpc.LogPosition, error)
ReplayPosition will return the oldest replay position across the full space range of all the encodings. If there are points that don't have any results it'll return an error.
func (*LogStatusResult) ReplayPositionInSpace ¶
func (r *LogStatusResult) ReplayPositionInSpace(enc rpc.FactKeyEncoding, covering space.Range) (rpc.LogPosition, error)
ReplayPositionInSpace will return the recommended replay position for the indicated range of the encoding space. If a point in this requested space does not have any valid results for it it'll return an error. If there are enough views (more than 2) for a partition, it'll ignore the worst value for that partition so that significant laggards or new views still catching up don't force processing of a lot of log. e.g. for the carousel its worth skipping the trailing view so that we can carousel at a more recent index requiring less catchup work once the carousel completes
func (*LogStatusResult) Results ¶
func (r *LogStatusResult) Results() ([]*rpc.LogStatusResult, []error)
Results returns the underlying LogStatusResult and error for all the requested views
type ReadFactsPOClient ¶
type ReadFactsPOClient struct { View viewreg.View Stub rpc.ReadFactsPOClient }
ReadFactsPOClient is a client for the ReadFactsPO service running on the particular view instance
func (*ReadFactsPOClient) Serves ¶
func (c *ReadFactsPOClient) Serves() space.Range
Serves returns the hash range that this view contains. this is an implementation of the fanout.View interface
func (*ReadFactsPOClient) String ¶
func (c *ReadFactsPOClient) String() string
type ReadFactsPOClients ¶
type ReadFactsPOClients []*ReadFactsPOClient
ReadFactsPOClients is a collection of ReadFatsPOClient's. Typically you'd get these from a call to Client.ReadFactsPOViews()
func (ReadFactsPOClients) Len ¶
func (c ReadFactsPOClients) Len() int
Len returns the number of clients in this collection. This is part of the implementation of the fanout.Views interface
type ReadFactsSPClient ¶
type ReadFactsSPClient struct { View viewreg.View Stub rpc.ReadFactsSPClient }
ReadFactsSPClient is a client for the ReadFactsSP service running on the particular view instance
func (*ReadFactsSPClient) Serves ¶
func (c *ReadFactsSPClient) Serves() space.Range
Serves returns the range in Hash(SP) space that the related view contains. This is an implementation of the fanout.View interface
func (*ReadFactsSPClient) String ¶
func (c *ReadFactsSPClient) String() string
type ReadFactsSPClients ¶
type ReadFactsSPClients []*ReadFactsSPClient
ReadFactsSPClients is a collection of ReadFactsSPClient's. You typically get one of these from calling Client.ReadFactsSPViews()
func (ReadFactsSPClients) Len ¶
func (c ReadFactsSPClients) Len() int
Len returns the number of clients in this collection. This is part of the implementation of the fanout.Views interface
type StreamingConvention ¶
StreamingConvention documents the calling convention for streaming RPC results. It's not a type used in the code: this exists only for documentation.
The function will send incremental results on resCh until either: it completes successfully and returns nil, or it encounters an error and returns the error. Note that the function may complete successfully without sending any results on resCh. Whether it completes successfully or returns an error, the function closes resCh before returning.
type ViewInfoPredicate ¶
A ViewInfoPredicate is used to filter views. Sometimes nil is used in place of a predicate that always returns true.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package fanout is useful for invoking RPCs across a bunch of servers.
|
Package fanout is useful for invoking RPCs across a bunch of servers. |
Package lookups defines go interfaces that the various LookupXX rpc wrappers expose, this can be useful in decoupling the actual Loopup implementation from its usage, allowing for easier testing
|
Package lookups defines go interfaces that the various LookupXX rpc wrappers expose, this can be useful in decoupling the actual Loopup implementation from its usage, allowing for easier testing |
mocklookups
Package mocklookups provides a mock implementation of the various Fact lookup RPCs.
|
Package mocklookups provides a mock implementation of the various Fact lookup RPCs. |
Package mockstore provides various mocks that store facts and can execute lookups against them.
|
Package mockstore provides various mocks that store facts and can execute lookups against them. |
Package viewreg tracks all the known view servers in the cluster.
|
Package viewreg tracks all the known view servers in the cluster. |