# Interface UploadMatcher

All Known Implementing Classes:
  `CdsUploadMatcher, TapUploadMatcher`

public interface UploadMatcher
Defines a service that can perform sky position crossmatches by taking a sequence of cone-like positions for input and submitting them as a block to a remote execution matching service.

The details of the methods are specified so that input can be streamed and output can be stored, with a final result table re-using table data from a reference input table that may have columns other than those represented by the cone sequence. It is also amenable to chunking the queries and responses.

Since:
  14 May 2014
Author:
  Mark Taylor

## Method Summary

Modifier and Type
Method
Description
`ColumnPlan`
`getColumnPlan(uk.ac.starlink.table.ColumnInfo[] resultCols, uk.ac.starlink.table.ColumnInfo[] uploadCols)`
Returns an object that understands what columns are where in an output table generated from the raw result produced by this matcher.
`boolean`
`streamRawResult(ConeQueryRowSequence coneSeq, uk.ac.starlink.table.TableSink rawResultSink, RowMapper<?> rowMapper, long maxrec)`
Scans a sequence of positional queries, uploads it to a remote service, and writes the returned values to a given sink.

## Method Details

### streamRawResult

boolean streamRawResult(ConeQueryRowSequence coneSeq, uk.ac.starlink.table.TableSink rawResultSink, RowMapper<?> rowMapper, long maxrec) throws IOException
Scans a sequence of positional queries, uploads it to a remote service, and writes the returned values to a given sink.

Both the read and the write should ideally be streamed (read as uploaded and written as received) so that progress can be logged properly.

The result is written to the given `rawResultSink` (which will probably be a `RowStore`). To make sense of the table thus written, it is necessary to use the `RowMapper` supplied to this method and the `ColumnPlan` available from this object. The RowMapper associates result rows with queries from the input row sequence, and the ColumnPlan knows where the special and other columns are in the result table.

Parameters:
  `coneSeq` - sequence of cone-like positional queries
  `rawResultSink` - destination for result rows obtained from the target matcher service
  `rowMapper` - used to label rows; queries are labelled with the value returned from the `getIndex` method of `coneSeq`
  `maxrec` - user-supplied limit on the maximum number of output rows, though the service may truncate the result; if <0, no limit is requested
Returns:
  true iff the result was truncated due to overflow
Throws:
  `IOException`

### getColumnPlan

ColumnPlan getColumnPlan(uk.ac.starlink.table.ColumnInfo[] resultCols, uk.ac.starlink.table.ColumnInfo[] uploadCols)
Returns an object that understands what columns are where in an output table generated from the raw result produced by this matcher.

Parameters:
  `resultCols` - columns in the raw result table written by this object's `streamRawResult` method
  `uploadCols` - columns from the table that will be joined to the raw result to get the output table
Returns:
  column plan