arrow: github.com/apache/arrow/go/arrow/flight Index | Examples | Files

package flight

import "github.com/apache/arrow/go/arrow/flight"

Code:

// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package main

import (
    "context"
    "fmt"
    "io"
    "log"

    "github.com/apache/arrow/go/arrow/flight"
    "google.golang.org/grpc"
    "google.golang.org/grpc/codes"
    "google.golang.org/grpc/status"
)

type serverAuth struct{}

func (sa *serverAuth) Authenticate(c flight.AuthConn) error {
    in, err := c.Read()
    if err == io.EOF {
        return status.Error(codes.Unauthenticated, "no auth info provided")
    }

    if err != nil {
        return status.Error(codes.FailedPrecondition, "error reading auth handshake")
    }

    // do something with in....
    fmt.Println(string(in))

    // send auth token back
    return c.Send([]byte("foobar"))
}

func (sa *serverAuth) IsValid(token string) (interface{}, error) {
    if token == "foobar" {
        return "foo", nil
    }
    return "", status.Error(codes.PermissionDenied, "invalid auth token")
}

func main() {
    server := flight.NewFlightServer(&serverAuth{})
    server.Init("localhost:0")
    server.RegisterFlightService(&flight.FlightServiceService{})

    go server.Serve()
    defer server.Shutdown()

    conn, err := grpc.Dial(server.Addr().String(), grpc.WithInsecure())
    if err != nil {
        log.Fatal(err)
    }
    defer conn.Close()

    client := flight.NewFlightServiceClient(conn)
    stream, err := client.Handshake(context.Background())
    if err != nil {
        log.Fatal(err)
    }

    // ignore error handling here for brevity
    stream.Send(&flight.HandshakeRequest{Payload: []byte("baz")})

    resp, _ := stream.Recv()
    fmt.Println(string(resp.Payload))

}

Index

Examples

Package Files

Flight.pb.go Flight_grpc.pb.go client.go client_auth.go gen.go server.go server_auth.go

Variables

var (
    FlightDescriptor_DescriptorType_name = map[int32]string{
        0:  "UNKNOWN",
        1:  "PATH",
        2:  "CMD",
    }
    FlightDescriptor_DescriptorType_value = map[string]int32{
        "UNKNOWN": 0,
        "PATH":    1,
        "CMD":     2,
    }
)

Enum value maps for FlightDescriptor_DescriptorType.

var File_Flight_proto protoreflect.FileDescriptor

func AuthFromContext Uses

func AuthFromContext(ctx context.Context) interface{}

AuthFromContext will return back whatever object was returned from `IsValid` for a given request context allowing handlers to retrieve identifying information for the current request for use.

func RegisterFlightServiceService Uses

func RegisterFlightServiceService(s grpc.ServiceRegistrar, srv *FlightServiceService)

RegisterFlightServiceService registers a service implementation with a gRPC server.

type Action Uses

type Action struct {
    Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
    Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"`
    // contains filtered or unexported fields
}

An opaque action specific for the service.

func (*Action) Descriptor Uses

func (*Action) Descriptor() ([]byte, []int)

Deprecated: Use Action.ProtoReflect.Descriptor instead.

func (*Action) GetBody Uses

func (x *Action) GetBody() []byte

func (*Action) GetType Uses

func (x *Action) GetType() string

func (*Action) ProtoMessage Uses

func (*Action) ProtoMessage()

func (*Action) ProtoReflect Uses

func (x *Action) ProtoReflect() protoreflect.Message

func (*Action) Reset Uses

func (x *Action) Reset()

func (*Action) String Uses

func (x *Action) String() string

type ActionType Uses

type ActionType struct {
    Type        string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
    Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
    // contains filtered or unexported fields
}

Describes an available action, including both the name used for execution along with a short description of the purpose of the action.

func (*ActionType) Descriptor Uses

func (*ActionType) Descriptor() ([]byte, []int)

Deprecated: Use ActionType.ProtoReflect.Descriptor instead.

func (*ActionType) GetDescription Uses

func (x *ActionType) GetDescription() string

func (*ActionType) GetType Uses

func (x *ActionType) GetType() string

func (*ActionType) ProtoMessage Uses

func (*ActionType) ProtoMessage()

func (*ActionType) ProtoReflect Uses

func (x *ActionType) ProtoReflect() protoreflect.Message

func (*ActionType) Reset Uses

func (x *ActionType) Reset()

func (*ActionType) String Uses

func (x *ActionType) String() string

type AuthConn Uses

type AuthConn interface {
    Read() ([]byte, error)
    Send([]byte) error
}

AuthConn wraps the stream from grpc for handshakes to simplify handling handshake request and response from the flight.proto forwarding just the payloads and errors instead of having to deal with the handshake request and response protos directly

type BasicAuth Uses

type BasicAuth struct {
    Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
    Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"`
    // contains filtered or unexported fields
}

A message for doing simple auth.

func (*BasicAuth) Descriptor Uses

func (*BasicAuth) Descriptor() ([]byte, []int)

Deprecated: Use BasicAuth.ProtoReflect.Descriptor instead.

func (*BasicAuth) GetPassword Uses

func (x *BasicAuth) GetPassword() string

func (*BasicAuth) GetUsername Uses

func (x *BasicAuth) GetUsername() string

func (*BasicAuth) ProtoMessage Uses

func (*BasicAuth) ProtoMessage()

func (*BasicAuth) ProtoReflect Uses

func (x *BasicAuth) ProtoReflect() protoreflect.Message

func (*BasicAuth) Reset Uses

func (x *BasicAuth) Reset()

func (*BasicAuth) String Uses

func (x *BasicAuth) String() string

type Client Uses

type Client interface {
    // Authenticate uses the ClientAuthHandler that was used when creating the client
    // in order to use the Handshake endpoints of the service.
    Authenticate(context.Context, ...grpc.CallOption) error
    Close() error
    // join the interface from the FlightServiceClient instead of re-defining all
    // the endpoints here.
    FlightServiceClient
}

Client is an interface wrapped around the generated FlightServiceClient which is generated by grpc protobuf definitions. This interface provides a useful hiding of the authentication handshake via calling Authenticate and using the ClientAuthHandler rather than manually having to implement the grpc communication and sending of the auth token.

func NewFlightClient Uses

func NewFlightClient(addr string, auth ClientAuthHandler, opts ...grpc.DialOption) (Client, error)

NewFlightClient takes in the address of the grpc server and an auth handler for the application-level handshake. If using TLS or other grpc configurations they can still be passed via the grpc.DialOption list just as if connecting manually without this helper function.

Alternatively, a grpc client can be constructed as normal without this helper as the grpc generated client code is still exported. This exists to add utility and helpers around the authentication and passing the token with requests.

type ClientAuthHandler Uses

type ClientAuthHandler interface {
    Authenticate(AuthConn) error
    GetToken() (string, error)
}

ClientAuthHandler defines an interface for the Flight client to perform the authentication handshake. The token that is retrieved from GetToken will be sent as part of the context metadata in subsequent requests after authentication is performed using the key "auth-token-bin".

type Criteria Uses

type Criteria struct {
    Expression []byte `protobuf:"bytes,1,opt,name=expression,proto3" json:"expression,omitempty"`
    // contains filtered or unexported fields
}

A service specific expression that can be used to return a limited set of available Arrow Flight streams.

func (*Criteria) Descriptor Uses

func (*Criteria) Descriptor() ([]byte, []int)

Deprecated: Use Criteria.ProtoReflect.Descriptor instead.

func (*Criteria) GetExpression Uses

func (x *Criteria) GetExpression() []byte

func (*Criteria) ProtoMessage Uses

func (*Criteria) ProtoMessage()

func (*Criteria) ProtoReflect Uses

func (x *Criteria) ProtoReflect() protoreflect.Message

func (*Criteria) Reset Uses

func (x *Criteria) Reset()

func (*Criteria) String Uses

func (x *Criteria) String() string

type Empty Uses

type Empty struct {
    // contains filtered or unexported fields
}

func (*Empty) Descriptor Uses

func (*Empty) Descriptor() ([]byte, []int)

Deprecated: Use Empty.ProtoReflect.Descriptor instead.

func (*Empty) ProtoMessage Uses

func (*Empty) ProtoMessage()

func (*Empty) ProtoReflect Uses

func (x *Empty) ProtoReflect() protoreflect.Message

func (*Empty) Reset Uses

func (x *Empty) Reset()

func (*Empty) String Uses

func (x *Empty) String() string

type FlightData Uses

type FlightData struct {

    //
    // The descriptor of the data. This is only relevant when a client is
    // starting a new DoPut stream.
    FlightDescriptor *FlightDescriptor `protobuf:"bytes,1,opt,name=flight_descriptor,json=flightDescriptor,proto3" json:"flight_descriptor,omitempty"`
    //
    // Header for message data as described in Message.fbs::Message.
    DataHeader []byte `protobuf:"bytes,2,opt,name=data_header,json=dataHeader,proto3" json:"data_header,omitempty"`
    //
    // Application-defined metadata.
    AppMetadata []byte `protobuf:"bytes,3,opt,name=app_metadata,json=appMetadata,proto3" json:"app_metadata,omitempty"`
    //
    // The actual batch of Arrow data. Preferably handled with minimal-copies
    // coming last in the definition to help with sidecar patterns (it is
    // expected that some implementations will fetch this field off the wire
    // with specialized code to avoid extra memory copies).
    DataBody []byte `protobuf:"bytes,1000,opt,name=data_body,json=dataBody,proto3" json:"data_body,omitempty"`
    // contains filtered or unexported fields
}

A batch of Arrow data as part of a stream of batches.

func (*FlightData) Descriptor Uses

func (*FlightData) Descriptor() ([]byte, []int)

Deprecated: Use FlightData.ProtoReflect.Descriptor instead.

func (*FlightData) GetAppMetadata Uses

func (x *FlightData) GetAppMetadata() []byte

func (*FlightData) GetDataBody Uses

func (x *FlightData) GetDataBody() []byte

func (*FlightData) GetDataHeader Uses

func (x *FlightData) GetDataHeader() []byte

func (*FlightData) GetFlightDescriptor Uses

func (x *FlightData) GetFlightDescriptor() *FlightDescriptor

func (*FlightData) ProtoMessage Uses

func (*FlightData) ProtoMessage()

func (*FlightData) ProtoReflect Uses

func (x *FlightData) ProtoReflect() protoreflect.Message

func (*FlightData) Reset Uses

func (x *FlightData) Reset()

func (*FlightData) String Uses

func (x *FlightData) String() string

type FlightDescriptor Uses

type FlightDescriptor struct {
    Type FlightDescriptor_DescriptorType `protobuf:"varint,1,opt,name=type,proto3,enum=arrow.flight.protocol.FlightDescriptor_DescriptorType" json:"type,omitempty"`
    //
    // Opaque value used to express a command. Should only be defined when
    // type = CMD.
    Cmd []byte `protobuf:"bytes,2,opt,name=cmd,proto3" json:"cmd,omitempty"`
    //
    // List of strings identifying a particular dataset. Should only be defined
    // when type = PATH.
    Path []string `protobuf:"bytes,3,rep,name=path,proto3" json:"path,omitempty"`
    // contains filtered or unexported fields
}

The name or tag for a Flight. May be used as a way to retrieve or generate a flight or be used to expose a set of previously defined flights.

func (*FlightDescriptor) Descriptor Uses

func (*FlightDescriptor) Descriptor() ([]byte, []int)

Deprecated: Use FlightDescriptor.ProtoReflect.Descriptor instead.

func (*FlightDescriptor) GetCmd Uses

func (x *FlightDescriptor) GetCmd() []byte

func (*FlightDescriptor) GetPath Uses

func (x *FlightDescriptor) GetPath() []string

func (*FlightDescriptor) GetType Uses

func (x *FlightDescriptor) GetType() FlightDescriptor_DescriptorType

func (*FlightDescriptor) ProtoMessage Uses

func (*FlightDescriptor) ProtoMessage()

func (*FlightDescriptor) ProtoReflect Uses

func (x *FlightDescriptor) ProtoReflect() protoreflect.Message

func (*FlightDescriptor) Reset Uses

func (x *FlightDescriptor) Reset()

func (*FlightDescriptor) String Uses

func (x *FlightDescriptor) String() string

type FlightDescriptor_DescriptorType Uses

type FlightDescriptor_DescriptorType int32

Describes what type of descriptor is defined.

const (
    // Protobuf pattern, not used.
    FlightDescriptor_UNKNOWN FlightDescriptor_DescriptorType = 0
    //
    // A named path that identifies a dataset. A path is composed of a string
    // or list of strings describing a particular dataset. This is conceptually
    //  similar to a path inside a filesystem.
    FlightDescriptor_PATH FlightDescriptor_DescriptorType = 1
    //
    // An opaque command to generate a dataset.
    FlightDescriptor_CMD FlightDescriptor_DescriptorType = 2
)

func (FlightDescriptor_DescriptorType) Descriptor Uses

func (FlightDescriptor_DescriptorType) Descriptor() protoreflect.EnumDescriptor

func (FlightDescriptor_DescriptorType) Enum Uses

func (x FlightDescriptor_DescriptorType) Enum() *FlightDescriptor_DescriptorType

func (FlightDescriptor_DescriptorType) EnumDescriptor Uses

func (FlightDescriptor_DescriptorType) EnumDescriptor() ([]byte, []int)

Deprecated: Use FlightDescriptor_DescriptorType.Descriptor instead.

func (FlightDescriptor_DescriptorType) Number Uses

func (x FlightDescriptor_DescriptorType) Number() protoreflect.EnumNumber

func (FlightDescriptor_DescriptorType) String Uses

func (x FlightDescriptor_DescriptorType) String() string

func (FlightDescriptor_DescriptorType) Type Uses

func (FlightDescriptor_DescriptorType) Type() protoreflect.EnumType

type FlightEndpoint Uses

type FlightEndpoint struct {

    //
    // Token used to retrieve this stream.
    Ticket *Ticket `protobuf:"bytes,1,opt,name=ticket,proto3" json:"ticket,omitempty"`
    //
    // A list of URIs where this ticket can be redeemed. If the list is
    // empty, the expectation is that the ticket can only be redeemed on the
    // current service where the ticket was generated.
    Location []*Location `protobuf:"bytes,2,rep,name=location,proto3" json:"location,omitempty"`
    // contains filtered or unexported fields
}

A particular stream or split associated with a flight.

func (*FlightEndpoint) Descriptor Uses

func (*FlightEndpoint) Descriptor() ([]byte, []int)

Deprecated: Use FlightEndpoint.ProtoReflect.Descriptor instead.

func (*FlightEndpoint) GetLocation Uses

func (x *FlightEndpoint) GetLocation() []*Location

func (*FlightEndpoint) GetTicket Uses

func (x *FlightEndpoint) GetTicket() *Ticket

func (*FlightEndpoint) ProtoMessage Uses

func (*FlightEndpoint) ProtoMessage()

func (*FlightEndpoint) ProtoReflect Uses

func (x *FlightEndpoint) ProtoReflect() protoreflect.Message

func (*FlightEndpoint) Reset Uses

func (x *FlightEndpoint) Reset()

func (*FlightEndpoint) String Uses

func (x *FlightEndpoint) String() string

type FlightInfo Uses

type FlightInfo struct {

    // schema of the dataset as described in Schema.fbs::Schema.
    Schema []byte `protobuf:"bytes,1,opt,name=schema,proto3" json:"schema,omitempty"`
    //
    // The descriptor associated with this info.
    FlightDescriptor *FlightDescriptor `protobuf:"bytes,2,opt,name=flight_descriptor,json=flightDescriptor,proto3" json:"flight_descriptor,omitempty"`
    //
    // A list of endpoints associated with the flight. To consume the whole
    // flight, all endpoints must be consumed.
    Endpoint []*FlightEndpoint `protobuf:"bytes,3,rep,name=endpoint,proto3" json:"endpoint,omitempty"`
    // Set these to -1 if unknown.
    TotalRecords int64 `protobuf:"varint,4,opt,name=total_records,json=totalRecords,proto3" json:"total_records,omitempty"`
    TotalBytes   int64 `protobuf:"varint,5,opt,name=total_bytes,json=totalBytes,proto3" json:"total_bytes,omitempty"`
    // contains filtered or unexported fields
}

The access coordinates for retrieval of a dataset. With a FlightInfo, a consumer is able to determine how to retrieve a dataset.

func (*FlightInfo) Descriptor Uses

func (*FlightInfo) Descriptor() ([]byte, []int)

Deprecated: Use FlightInfo.ProtoReflect.Descriptor instead.

func (*FlightInfo) GetEndpoint Uses

func (x *FlightInfo) GetEndpoint() []*FlightEndpoint

func (*FlightInfo) GetFlightDescriptor Uses

func (x *FlightInfo) GetFlightDescriptor() *FlightDescriptor

func (*FlightInfo) GetSchema Uses

func (x *FlightInfo) GetSchema() []byte

func (*FlightInfo) GetTotalBytes Uses

func (x *FlightInfo) GetTotalBytes() int64

func (*FlightInfo) GetTotalRecords Uses

func (x *FlightInfo) GetTotalRecords() int64

func (*FlightInfo) ProtoMessage Uses

func (*FlightInfo) ProtoMessage()

func (*FlightInfo) ProtoReflect Uses

func (x *FlightInfo) ProtoReflect() protoreflect.Message

func (*FlightInfo) Reset Uses

func (x *FlightInfo) Reset()

func (*FlightInfo) String Uses

func (x *FlightInfo) String() string

type FlightServiceClient Uses

type FlightServiceClient interface {
    //
    // Handshake between client and server. Depending on the server, the
    // handshake may be required to determine the token that should be used for
    // future operations. Both request and response are streams to allow multiple
    // round-trips depending on auth mechanism.
    Handshake(ctx context.Context, opts ...grpc.CallOption) (FlightService_HandshakeClient, error)
    //
    // Get a list of available streams given a particular criteria. Most flight
    // services will expose one or more streams that are readily available for
    // retrieval. This api allows listing the streams available for
    // consumption. A user can also provide a criteria. The criteria can limit
    // the subset of streams that can be listed via this interface. Each flight
    // service allows its own definition of how to consume criteria.
    ListFlights(ctx context.Context, in *Criteria, opts ...grpc.CallOption) (FlightService_ListFlightsClient, error)
    //
    // For a given FlightDescriptor, get information about how the flight can be
    // consumed. This is a useful interface if the consumer of the interface
    // already can identify the specific flight to consume. This interface can
    // also allow a consumer to generate a flight stream through a specified
    // descriptor. For example, a flight descriptor might be something that
    // includes a SQL statement or a Pickled Python operation that will be
    // executed. In those cases, the descriptor will not be previously available
    // within the list of available streams provided by ListFlights but will be
    // available for consumption for the duration defined by the specific flight
    // service.
    GetFlightInfo(ctx context.Context, in *FlightDescriptor, opts ...grpc.CallOption) (*FlightInfo, error)
    //
    // For a given FlightDescriptor, get the Schema as described in Schema.fbs::Schema
    // This is used when a consumer needs the Schema of flight stream. Similar to
    // GetFlightInfo this interface may generate a new flight that was not previously
    // available in ListFlights.
    GetSchema(ctx context.Context, in *FlightDescriptor, opts ...grpc.CallOption) (*SchemaResult, error)
    //
    // Retrieve a single stream associated with a particular descriptor
    // associated with the referenced ticket. A Flight can be composed of one or
    // more streams where each stream can be retrieved using a separate opaque
    // ticket that the flight service uses for managing a collection of streams.
    DoGet(ctx context.Context, in *Ticket, opts ...grpc.CallOption) (FlightService_DoGetClient, error)
    //
    // Push a stream to the flight service associated with a particular
    // flight stream. This allows a client of a flight service to upload a stream
    // of data. Depending on the particular flight service, a client consumer
    // could be allowed to upload a single stream per descriptor or an unlimited
    // number. In the latter, the service might implement a 'seal' action that
    // can be applied to a descriptor once all streams are uploaded.
    DoPut(ctx context.Context, opts ...grpc.CallOption) (FlightService_DoPutClient, error)
    //
    // Open a bidirectional data channel for a given descriptor. This
    // allows clients to send and receive arbitrary Arrow data and
    // application-specific metadata in a single logical stream. In
    // contrast to DoGet/DoPut, this is more suited for clients
    // offloading computation (rather than storage) to a Flight service.
    DoExchange(ctx context.Context, opts ...grpc.CallOption) (FlightService_DoExchangeClient, error)
    //
    // Flight services can support an arbitrary number of simple actions in
    // addition to the possible ListFlights, GetFlightInfo, DoGet, DoPut
    // operations that are potentially available. DoAction allows a flight client
    // to do a specific action against a flight service. An action includes
    // opaque request and response objects that are specific to the type action
    // being undertaken.
    DoAction(ctx context.Context, in *Action, opts ...grpc.CallOption) (FlightService_DoActionClient, error)
    //
    // A flight service exposes all of the available action types that it has
    // along with descriptions. This allows different flight consumers to
    // understand the capabilities of the flight service.
    ListActions(ctx context.Context, in *Empty, opts ...grpc.CallOption) (FlightService_ListActionsClient, error)
}

FlightServiceClient is the client API for FlightService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewFlightServiceClient Uses

func NewFlightServiceClient(cc grpc.ClientConnInterface) FlightServiceClient

type FlightServiceService Uses

type FlightServiceService struct {
    //
    // Handshake between client and server. Depending on the server, the
    // handshake may be required to determine the token that should be used for
    // future operations. Both request and response are streams to allow multiple
    // round-trips depending on auth mechanism.
    Handshake func(FlightService_HandshakeServer) error
    //
    // Get a list of available streams given a particular criteria. Most flight
    // services will expose one or more streams that are readily available for
    // retrieval. This api allows listing the streams available for
    // consumption. A user can also provide a criteria. The criteria can limit
    // the subset of streams that can be listed via this interface. Each flight
    // service allows its own definition of how to consume criteria.
    ListFlights func(*Criteria, FlightService_ListFlightsServer) error
    //
    // For a given FlightDescriptor, get information about how the flight can be
    // consumed. This is a useful interface if the consumer of the interface
    // already can identify the specific flight to consume. This interface can
    // also allow a consumer to generate a flight stream through a specified
    // descriptor. For example, a flight descriptor might be something that
    // includes a SQL statement or a Pickled Python operation that will be
    // executed. In those cases, the descriptor will not be previously available
    // within the list of available streams provided by ListFlights but will be
    // available for consumption for the duration defined by the specific flight
    // service.
    GetFlightInfo func(context.Context, *FlightDescriptor) (*FlightInfo, error)
    //
    // For a given FlightDescriptor, get the Schema as described in Schema.fbs::Schema
    // This is used when a consumer needs the Schema of flight stream. Similar to
    // GetFlightInfo this interface may generate a new flight that was not previously
    // available in ListFlights.
    GetSchema func(context.Context, *FlightDescriptor) (*SchemaResult, error)
    //
    // Retrieve a single stream associated with a particular descriptor
    // associated with the referenced ticket. A Flight can be composed of one or
    // more streams where each stream can be retrieved using a separate opaque
    // ticket that the flight service uses for managing a collection of streams.
    DoGet func(*Ticket, FlightService_DoGetServer) error
    //
    // Push a stream to the flight service associated with a particular
    // flight stream. This allows a client of a flight service to upload a stream
    // of data. Depending on the particular flight service, a client consumer
    // could be allowed to upload a single stream per descriptor or an unlimited
    // number. In the latter, the service might implement a 'seal' action that
    // can be applied to a descriptor once all streams are uploaded.
    DoPut func(FlightService_DoPutServer) error
    //
    // Open a bidirectional data channel for a given descriptor. This
    // allows clients to send and receive arbitrary Arrow data and
    // application-specific metadata in a single logical stream. In
    // contrast to DoGet/DoPut, this is more suited for clients
    // offloading computation (rather than storage) to a Flight service.
    DoExchange func(FlightService_DoExchangeServer) error
    //
    // Flight services can support an arbitrary number of simple actions in
    // addition to the possible ListFlights, GetFlightInfo, DoGet, DoPut
    // operations that are potentially available. DoAction allows a flight client
    // to do a specific action against a flight service. An action includes
    // opaque request and response objects that are specific to the type action
    // being undertaken.
    DoAction func(*Action, FlightService_DoActionServer) error
    //
    // A flight service exposes all of the available action types that it has
    // along with descriptions. This allows different flight consumers to
    // understand the capabilities of the flight service.
    ListActions func(*Empty, FlightService_ListActionsServer) error
}

FlightServiceService is the service API for FlightService service. Fields should be assigned to their respective handler implementations only before RegisterFlightServiceService is called. Any unassigned fields will result in the handler for that method returning an Unimplemented error.

func NewFlightServiceService Uses

func NewFlightServiceService(s interface{}) *FlightServiceService

NewFlightServiceService creates a new FlightServiceService containing the implemented methods of the FlightService service in s. Any unimplemented methods will result in the gRPC server returning an UNIMPLEMENTED status to the client. This includes situations where the method handler is misspelled or has the wrong signature. For this reason, this function should be used with great care and is not recommended to be used by most users.

type FlightService_DoActionClient Uses

type FlightService_DoActionClient interface {
    Recv() (*Result, error)
    grpc.ClientStream
}

type FlightService_DoActionServer Uses

type FlightService_DoActionServer interface {
    Send(*Result) error
    grpc.ServerStream
}

type FlightService_DoExchangeClient Uses

type FlightService_DoExchangeClient interface {
    Send(*FlightData) error
    Recv() (*FlightData, error)
    grpc.ClientStream
}

type FlightService_DoExchangeServer Uses

type FlightService_DoExchangeServer interface {
    Send(*FlightData) error
    Recv() (*FlightData, error)
    grpc.ServerStream
}

type FlightService_DoGetClient Uses

type FlightService_DoGetClient interface {
    Recv() (*FlightData, error)
    grpc.ClientStream
}

type FlightService_DoGetServer Uses

type FlightService_DoGetServer interface {
    Send(*FlightData) error
    grpc.ServerStream
}

type FlightService_DoPutClient Uses

type FlightService_DoPutClient interface {
    Send(*FlightData) error
    Recv() (*PutResult, error)
    grpc.ClientStream
}

type FlightService_DoPutServer Uses

type FlightService_DoPutServer interface {
    Send(*PutResult) error
    Recv() (*FlightData, error)
    grpc.ServerStream
}

type FlightService_HandshakeClient Uses

type FlightService_HandshakeClient interface {
    Send(*HandshakeRequest) error
    Recv() (*HandshakeResponse, error)
    grpc.ClientStream
}

type FlightService_HandshakeServer Uses

type FlightService_HandshakeServer interface {
    Send(*HandshakeResponse) error
    Recv() (*HandshakeRequest, error)
    grpc.ServerStream
}

type FlightService_ListActionsClient Uses

type FlightService_ListActionsClient interface {
    Recv() (*ActionType, error)
    grpc.ClientStream
}

type FlightService_ListActionsServer Uses

type FlightService_ListActionsServer interface {
    Send(*ActionType) error
    grpc.ServerStream
}

type FlightService_ListFlightsClient Uses

type FlightService_ListFlightsClient interface {
    Recv() (*FlightInfo, error)
    grpc.ClientStream
}

type FlightService_ListFlightsServer Uses

type FlightService_ListFlightsServer interface {
    Send(*FlightInfo) error
    grpc.ServerStream
}

type HandshakeRequest Uses

type HandshakeRequest struct {

    //
    // A defined protocol version
    ProtocolVersion uint64 `protobuf:"varint,1,opt,name=protocol_version,json=protocolVersion,proto3" json:"protocol_version,omitempty"`
    //
    // Arbitrary auth/handshake info.
    Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
    // contains filtered or unexported fields
}

The request that a client provides to a server on handshake.

func (*HandshakeRequest) Descriptor Uses

func (*HandshakeRequest) Descriptor() ([]byte, []int)

Deprecated: Use HandshakeRequest.ProtoReflect.Descriptor instead.

func (*HandshakeRequest) GetPayload Uses

func (x *HandshakeRequest) GetPayload() []byte

func (*HandshakeRequest) GetProtocolVersion Uses

func (x *HandshakeRequest) GetProtocolVersion() uint64

func (*HandshakeRequest) ProtoMessage Uses

func (*HandshakeRequest) ProtoMessage()

func (*HandshakeRequest) ProtoReflect Uses

func (x *HandshakeRequest) ProtoReflect() protoreflect.Message

func (*HandshakeRequest) Reset Uses

func (x *HandshakeRequest) Reset()

func (*HandshakeRequest) String Uses

func (x *HandshakeRequest) String() string

type HandshakeResponse Uses

type HandshakeResponse struct {

    //
    // A defined protocol version
    ProtocolVersion uint64 `protobuf:"varint,1,opt,name=protocol_version,json=protocolVersion,proto3" json:"protocol_version,omitempty"`
    //
    // Arbitrary auth/handshake info.
    Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
    // contains filtered or unexported fields
}

func (*HandshakeResponse) Descriptor Uses

func (*HandshakeResponse) Descriptor() ([]byte, []int)

Deprecated: Use HandshakeResponse.ProtoReflect.Descriptor instead.

func (*HandshakeResponse) GetPayload Uses

func (x *HandshakeResponse) GetPayload() []byte

func (*HandshakeResponse) GetProtocolVersion Uses

func (x *HandshakeResponse) GetProtocolVersion() uint64

func (*HandshakeResponse) ProtoMessage Uses

func (*HandshakeResponse) ProtoMessage()

func (*HandshakeResponse) ProtoReflect Uses

func (x *HandshakeResponse) ProtoReflect() protoreflect.Message

func (*HandshakeResponse) Reset Uses

func (x *HandshakeResponse) Reset()

func (*HandshakeResponse) String Uses

func (x *HandshakeResponse) String() string

type Location Uses

type Location struct {
    Uri string `protobuf:"bytes,1,opt,name=uri,proto3" json:"uri,omitempty"`
    // contains filtered or unexported fields
}

A location where a Flight service will accept retrieval of a particular stream given a ticket.

func (*Location) Descriptor Uses

func (*Location) Descriptor() ([]byte, []int)

Deprecated: Use Location.ProtoReflect.Descriptor instead.

func (*Location) GetUri Uses

func (x *Location) GetUri() string

func (*Location) ProtoMessage Uses

func (*Location) ProtoMessage()

func (*Location) ProtoReflect Uses

func (x *Location) ProtoReflect() protoreflect.Message

func (*Location) Reset Uses

func (x *Location) Reset()

func (*Location) String Uses

func (x *Location) String() string

type PutResult Uses

type PutResult struct {
    AppMetadata []byte `protobuf:"bytes,1,opt,name=app_metadata,json=appMetadata,proto3" json:"app_metadata,omitempty"`
    // contains filtered or unexported fields
}

* The response message associated with the submission of a DoPut.

func (*PutResult) Descriptor Uses

func (*PutResult) Descriptor() ([]byte, []int)

Deprecated: Use PutResult.ProtoReflect.Descriptor instead.

func (*PutResult) GetAppMetadata Uses

func (x *PutResult) GetAppMetadata() []byte

func (*PutResult) ProtoMessage Uses

func (*PutResult) ProtoMessage()

func (*PutResult) ProtoReflect Uses

func (x *PutResult) ProtoReflect() protoreflect.Message

func (*PutResult) Reset Uses

func (x *PutResult) Reset()

func (*PutResult) String Uses

func (x *PutResult) String() string

type Result Uses

type Result struct {
    Body []byte `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"`
    // contains filtered or unexported fields
}

An opaque result returned after executing an action.

func (*Result) Descriptor Uses

func (*Result) Descriptor() ([]byte, []int)

Deprecated: Use Result.ProtoReflect.Descriptor instead.

func (*Result) GetBody Uses

func (x *Result) GetBody() []byte

func (*Result) ProtoMessage Uses

func (*Result) ProtoMessage()

func (*Result) ProtoReflect Uses

func (x *Result) ProtoReflect() protoreflect.Message

func (*Result) Reset Uses

func (x *Result) Reset()

func (*Result) String Uses

func (x *Result) String() string

type SchemaResult Uses

type SchemaResult struct {

    // schema of the dataset as described in Schema.fbs::Schema.
    Schema []byte `protobuf:"bytes,1,opt,name=schema,proto3" json:"schema,omitempty"`
    // contains filtered or unexported fields
}

Wrap the result of a getSchema call

func (*SchemaResult) Descriptor Uses

func (*SchemaResult) Descriptor() ([]byte, []int)

Deprecated: Use SchemaResult.ProtoReflect.Descriptor instead.

func (*SchemaResult) GetSchema Uses

func (x *SchemaResult) GetSchema() []byte

func (*SchemaResult) ProtoMessage Uses

func (*SchemaResult) ProtoMessage()

func (*SchemaResult) ProtoReflect Uses

func (x *SchemaResult) ProtoReflect() protoreflect.Message

func (*SchemaResult) Reset Uses

func (x *SchemaResult) Reset()

func (*SchemaResult) String Uses

func (x *SchemaResult) String() string

type Server Uses

type Server interface {
    // Init takes in the address to bind to and creates the listener
    Init(addr string) error
    // Addr will return the address that was bound to for the service to listen on
    Addr() net.Addr
    // SetShutdownOnSignals sets notifications on the given signals to call GracefulStop
    // on the grpc service if any of those signals are received
    SetShutdownOnSignals(sig ...os.Signal)
    // Serve blocks until accepting a connection fails with a fatal error. It will return
    // a non-nil error unless it stopped due to calling Shutdown or receiving one of the
    // signals set in SetShutdownOnSignals
    Serve() error
    // Shutdown will call GracefulStop on the grpc server so that it stops accepting connections
    // and will wait until current methods complete
    Shutdown()
    // RegisterFlightService sets up the handler for the Flight Endpoints as per
    // normal Grpc setups
    RegisterFlightService(*FlightServiceService)
}

Server is an interface for hiding some of the grpc specifics to make it slightly easier to manage a flight service, slightly modeled after the C++ implementation

func NewFlightServer Uses

func NewFlightServer(auth ServerAuthHandler, opt ...grpc.ServerOption) Server

NewFlightServer takes in an auth handler for managing the handshake authentication and any grpc Server options desired, such as TLS certs and so on which will just be passed through to the underlying grpc server.

Alternatively, a grpc server can be created normally without this helper as the grpc server generated code is still being exported. This only exists to allow the utility of the helpers

type ServerAuthHandler Uses

type ServerAuthHandler interface {
    Authenticate(AuthConn) error
    IsValid(token string) (interface{}, error)
}

ServerAuthHandler defines an interface for the server to perform the handshake. The token is expected to be sent as part of the context metadata in subsequent requests with a key of "auth-token-bin" which will then call IsValid to validate

type Ticket Uses

type Ticket struct {
    Ticket []byte `protobuf:"bytes,1,opt,name=ticket,proto3" json:"ticket,omitempty"`
    // contains filtered or unexported fields
}

An opaque identifier that the service can use to retrieve a particular portion of a stream.

func (*Ticket) Descriptor Uses

func (*Ticket) Descriptor() ([]byte, []int)

Deprecated: Use Ticket.ProtoReflect.Descriptor instead.

func (*Ticket) GetTicket Uses

func (x *Ticket) GetTicket() []byte

func (*Ticket) ProtoMessage Uses

func (*Ticket) ProtoMessage()

func (*Ticket) ProtoReflect Uses

func (x *Ticket) ProtoReflect() protoreflect.Message

func (*Ticket) Reset Uses

func (x *Ticket) Reset()

func (*Ticket) String Uses

func (x *Ticket) String() string

type UnstableFlightServiceService Uses

type UnstableFlightServiceService interface {
    //
    // Handshake between client and server. Depending on the server, the
    // handshake may be required to determine the token that should be used for
    // future operations. Both request and response are streams to allow multiple
    // round-trips depending on auth mechanism.
    Handshake(FlightService_HandshakeServer) error
    //
    // Get a list of available streams given a particular criteria. Most flight
    // services will expose one or more streams that are readily available for
    // retrieval. This api allows listing the streams available for
    // consumption. A user can also provide a criteria. The criteria can limit
    // the subset of streams that can be listed via this interface. Each flight
    // service allows its own definition of how to consume criteria.
    ListFlights(*Criteria, FlightService_ListFlightsServer) error
    //
    // For a given FlightDescriptor, get information about how the flight can be
    // consumed. This is a useful interface if the consumer of the interface
    // already can identify the specific flight to consume. This interface can
    // also allow a consumer to generate a flight stream through a specified
    // descriptor. For example, a flight descriptor might be something that
    // includes a SQL statement or a Pickled Python operation that will be
    // executed. In those cases, the descriptor will not be previously available
    // within the list of available streams provided by ListFlights but will be
    // available for consumption for the duration defined by the specific flight
    // service.
    GetFlightInfo(context.Context, *FlightDescriptor) (*FlightInfo, error)
    //
    // For a given FlightDescriptor, get the Schema as described in Schema.fbs::Schema
    // This is used when a consumer needs the Schema of flight stream. Similar to
    // GetFlightInfo this interface may generate a new flight that was not previously
    // available in ListFlights.
    GetSchema(context.Context, *FlightDescriptor) (*SchemaResult, error)
    //
    // Retrieve a single stream associated with a particular descriptor
    // associated with the referenced ticket. A Flight can be composed of one or
    // more streams where each stream can be retrieved using a separate opaque
    // ticket that the flight service uses for managing a collection of streams.
    DoGet(*Ticket, FlightService_DoGetServer) error
    //
    // Push a stream to the flight service associated with a particular
    // flight stream. This allows a client of a flight service to upload a stream
    // of data. Depending on the particular flight service, a client consumer
    // could be allowed to upload a single stream per descriptor or an unlimited
    // number. In the latter, the service might implement a 'seal' action that
    // can be applied to a descriptor once all streams are uploaded.
    DoPut(FlightService_DoPutServer) error
    //
    // Open a bidirectional data channel for a given descriptor. This
    // allows clients to send and receive arbitrary Arrow data and
    // application-specific metadata in a single logical stream. In
    // contrast to DoGet/DoPut, this is more suited for clients
    // offloading computation (rather than storage) to a Flight service.
    DoExchange(FlightService_DoExchangeServer) error
    //
    // Flight services can support an arbitrary number of simple actions in
    // addition to the possible ListFlights, GetFlightInfo, DoGet, DoPut
    // operations that are potentially available. DoAction allows a flight client
    // to do a specific action against a flight service. An action includes
    // opaque request and response objects that are specific to the type action
    // being undertaken.
    DoAction(*Action, FlightService_DoActionServer) error
    //
    // A flight service exposes all of the available action types that it has
    // along with descriptions. This allows different flight consumers to
    // understand the capabilities of the flight service.
    ListActions(*Empty, FlightService_ListActionsServer) error
}

UnstableFlightServiceService is the service API for FlightService service. New methods may be added to this interface if they are added to the service definition, which is not a backward-compatible change. For this reason, use of this type is not recommended.

Package flight imports 14 packages (graph) and is imported by 1 packages. Updated 2020-10-04. Refresh now. Tools for package owners.