pilosa: github.com/pilosa/pilosa/http Index | Files

package http

import "github.com/pilosa/pilosa/http"

Index

Package Files

client.go error.go handler.go translator.go

Constants

const (
    QueryResultTypeRow uint32 = iota
    QueryResultTypePairs
    QueryResultTypeUint64
)

QueryResult types.

func GetHTTPClient Uses

func GetHTTPClient(t *tls.Config) *http.Client

func OpenTranslateReader Uses

func OpenTranslateReader(ctx context.Context, nodeURL string, offsets pilosa.TranslateOffsetMap) (pilosa.TranslateEntryReader, error)

func OptHandlerAPI Uses

func OptHandlerAPI(api *pilosa.API) handlerOption

func OptHandlerAllowedOrigins Uses

func OptHandlerAllowedOrigins(origins []string) handlerOption

func OptHandlerCloseTimeout Uses

func OptHandlerCloseTimeout(d time.Duration) handlerOption

OptHandlerCloseTimeout controls how long to wait for the http Server to shutdown cleanly before forcibly destroying it. Default is 30 seconds.

func OptHandlerListener Uses

func OptHandlerListener(ln net.Listener) handlerOption

func OptHandlerLogger Uses

func OptHandlerLogger(logger logger.Logger) handlerOption

type Bits Uses

type Bits []pilosa.Bit

Bits is a slice of Bit.

func (Bits) ColumnIDs Uses

func (p Bits) ColumnIDs() []uint64

ColumnIDs returns a slice of all the column IDs.

func (Bits) ColumnKeys Uses

func (p Bits) ColumnKeys() []string

ColumnKeys returns a slice of all the column keys.

func (Bits) GroupByShard Uses

func (p Bits) GroupByShard() map[uint64][]pilosa.Bit

GroupByShard returns a map of bits by shard.

func (Bits) HasColumnKeys Uses

func (p Bits) HasColumnKeys() bool

HasColumnKeys returns true if any values use a column key.

func (Bits) HasRowKeys Uses

func (p Bits) HasRowKeys() bool

HasRowKeys returns true if any values use a row key.

func (Bits) Len Uses

func (p Bits) Len() int

func (Bits) Less Uses

func (p Bits) Less(i, j int) bool

func (Bits) RowIDs Uses

func (p Bits) RowIDs() []uint64

RowIDs returns a slice of all the row IDs.

func (Bits) RowKeys Uses

func (p Bits) RowKeys() []string

RowKeys returns a slice of all the row keys.

func (Bits) Swap Uses

func (p Bits) Swap(i, j int)

func (Bits) Timestamps Uses

func (p Bits) Timestamps() []int64

Timestamps returns a slice of all the timestamps.

type BitsByPos Uses

type BitsByPos []pilosa.Bit

BitsByPos is a slice of bits sorted row then column.

func (BitsByPos) Len Uses

func (p BitsByPos) Len() int

func (BitsByPos) Less Uses

func (p BitsByPos) Less(i, j int) bool

func (BitsByPos) Swap Uses

func (p BitsByPos) Swap(i, j int)

type Error Uses

type Error struct {
    // Human-readable message.
    Message string `json:"message"`
}

Error defines a standard application error.

func (*Error) Error Uses

func (e *Error) Error() string

Error returns the string representation of the error message.

type FieldValues Uses

type FieldValues []pilosa.FieldValue

FieldValues represents a slice of field values.

func (FieldValues) ColumnIDs Uses

func (p FieldValues) ColumnIDs() []uint64

ColumnIDs returns a slice of all the column IDs.

func (FieldValues) ColumnKeys Uses

func (p FieldValues) ColumnKeys() []string

ColumnKeys returns a slice of all the column keys.

func (FieldValues) GroupByShard Uses

func (p FieldValues) GroupByShard() map[uint64][]pilosa.FieldValue

GroupByShard returns a map of field values by shard.

func (FieldValues) HasColumnKeys Uses

func (p FieldValues) HasColumnKeys() bool

HasColumnKeys returns true if any values use a column key.

func (FieldValues) Len Uses

func (p FieldValues) Len() int

func (FieldValues) Less Uses

func (p FieldValues) Less(i, j int) bool

func (FieldValues) Swap Uses

func (p FieldValues) Swap(i, j int)

func (FieldValues) Values Uses

func (p FieldValues) Values() []int64

Values returns a slice of all the values.

type Handler Uses

type Handler struct {
    Handler http.Handler
    // contains filtered or unexported fields
}

Handler represents an HTTP handler.

func NewHandler Uses

func NewHandler(opts ...handlerOption) (*Handler, error)

NewHandler returns a new instance of Handler with a default logger.

func (*Handler) Close Uses

func (h *Handler) Close() error

Close tries to cleanly shutdown the HTTP server, and failing that, after a timeout, calls Server.Close.

func (*Handler) Serve Uses

func (h *Handler) Serve() error

func (*Handler) ServeHTTP Uses

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles an HTTP request.

type InternalClient Uses

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

InternalClient represents a client to the Pilosa cluster.

func NewInternalClient Uses

func NewInternalClient(host string, remoteClient *http.Client) (*InternalClient, error)

NewInternalClient returns a new instance of InternalClient to connect to host.

func NewInternalClientFromURI Uses

func NewInternalClientFromURI(defaultURI *pilosa.URI, remoteClient *http.Client) *InternalClient

func (*InternalClient) BlockData Uses

func (c *InternalClient) BlockData(ctx context.Context, uri *pilosa.URI, index, field, view string, shard uint64, block int) ([]uint64, []uint64, error)

BlockData returns row/column id pairs for a block.

func (*InternalClient) ColumnAttrDiff Uses

func (c *InternalClient) ColumnAttrDiff(ctx context.Context, uri *pilosa.URI, index string, blks []pilosa.AttrBlock) (map[uint64]map[string]interface{}, error)

ColumnAttrDiff returns data from differing blocks on a remote host.

func (*InternalClient) CreateField Uses

func (c *InternalClient) CreateField(ctx context.Context, index, field string) error

func (*InternalClient) CreateFieldWithOptions Uses

func (c *InternalClient) CreateFieldWithOptions(ctx context.Context, index, field string, opt pilosa.FieldOptions) error

CreateField creates a new field on the server.

func (*InternalClient) CreateIndex Uses

func (c *InternalClient) CreateIndex(ctx context.Context, index string, opt pilosa.IndexOptions) error

CreateIndex creates a new index on the server.

func (*InternalClient) EnsureField Uses

func (c *InternalClient) EnsureField(ctx context.Context, indexName string, fieldName string) error

func (*InternalClient) EnsureFieldWithOptions Uses

func (c *InternalClient) EnsureFieldWithOptions(ctx context.Context, indexName string, fieldName string, opt pilosa.FieldOptions) error

func (*InternalClient) EnsureIndex Uses

func (c *InternalClient) EnsureIndex(ctx context.Context, name string, options pilosa.IndexOptions) error

func (*InternalClient) ExportCSV Uses

func (c *InternalClient) ExportCSV(ctx context.Context, index, field string, shard uint64, w io.Writer) error

ExportCSV bulk exports data for a single shard from a host to CSV format.

func (*InternalClient) FragmentBlocks Uses

func (c *InternalClient) FragmentBlocks(ctx context.Context, uri *pilosa.URI, index, field, view string, shard uint64) ([]pilosa.FragmentBlock, error)

FragmentBlocks returns a list of block checksums for a fragment on a host. Only returns blocks which contain data.

func (*InternalClient) FragmentNodes Uses

func (c *InternalClient) FragmentNodes(ctx context.Context, index string, shard uint64) ([]*pilosa.Node, error)

FragmentNodes returns a list of nodes that own a shard.

func (*InternalClient) Import Uses

func (c *InternalClient) Import(ctx context.Context, index, field string, shard uint64, bits []pilosa.Bit, opts ...pilosa.ImportOption) error

Import bulk imports bits for a single shard to a host.

func (*InternalClient) ImportK Uses

func (c *InternalClient) ImportK(ctx context.Context, index, field string, bits []pilosa.Bit, opts ...pilosa.ImportOption) error

ImportK bulk imports bits specified by string keys to a host.

func (*InternalClient) ImportRoaring Uses

func (c *InternalClient) ImportRoaring(ctx context.Context, uri *pilosa.URI, index, field string, shard uint64, remote bool, req *pilosa.ImportRoaringRequest) error

ImportRoaring does fast import of raw bits in roaring format (pilosa or official format, see API.ImportRoaring).

func (*InternalClient) ImportValue Uses

func (c *InternalClient) ImportValue(ctx context.Context, index, field string, shard uint64, vals []pilosa.FieldValue, opts ...pilosa.ImportOption) error

ImportValue bulk imports field values for a single shard to a host.

func (*InternalClient) ImportValueK Uses

func (c *InternalClient) ImportValueK(ctx context.Context, index, field string, vals []pilosa.FieldValue, opts ...pilosa.ImportOption) error

ImportValueK bulk imports keyed field values to a host.

func (*InternalClient) MaxShardByIndex Uses

func (c *InternalClient) MaxShardByIndex(ctx context.Context) (map[string]uint64, error)

MaxShardByIndex returns the number of shards on a server by index.

func (*InternalClient) Nodes Uses

func (c *InternalClient) Nodes(ctx context.Context) ([]*pilosa.Node, error)

Nodes returns a list of all nodes.

func (*InternalClient) PostSchema Uses

func (c *InternalClient) PostSchema(ctx context.Context, uri *pilosa.URI, s *pilosa.Schema, remote bool) error

func (*InternalClient) Query Uses

func (c *InternalClient) Query(ctx context.Context, index string, queryRequest *pilosa.QueryRequest) (*pilosa.QueryResponse, error)

Query executes query against the index.

func (*InternalClient) QueryNode Uses

func (c *InternalClient) QueryNode(ctx context.Context, uri *pilosa.URI, index string, queryRequest *pilosa.QueryRequest) (*pilosa.QueryResponse, error)

QueryNode executes query against the index, sending the request to the node specified.

func (*InternalClient) RetrieveShardFromURI Uses

func (c *InternalClient) RetrieveShardFromURI(ctx context.Context, index, field, view string, shard uint64, uri pilosa.URI) (io.ReadCloser, error)

RetrieveShardFromURI returns a ReadCloser which contains the data of the specified shard from the specified node. Caller *must* close the returned ReadCloser or risk leaking goroutines/tcp connections.

func (*InternalClient) RowAttrDiff Uses

func (c *InternalClient) RowAttrDiff(ctx context.Context, uri *pilosa.URI, index, field string, blks []pilosa.AttrBlock) (map[uint64]map[string]interface{}, error)

RowAttrDiff returns data from differing blocks on a remote host.

func (*InternalClient) Schema Uses

func (c *InternalClient) Schema(ctx context.Context) ([]*pilosa.IndexInfo, error)

Schema returns all index and field schema information.

func (*InternalClient) SendMessage Uses

func (c *InternalClient) SendMessage(ctx context.Context, uri *pilosa.URI, msg []byte) error

SendMessage posts a message synchronously.

type TranslateEntryReader Uses

type TranslateEntryReader struct {

    // Lookup of offsets for each index & field.
    // Must be set before calling Open().
    Offsets pilosa.TranslateOffsetMap

    // URL to stream entries from.
    // Must be set before calling Open().
    URL string

    HTTPClient *http.Client

    Logger logger.Logger
    // contains filtered or unexported fields
}

TranslateEntryReader represents an implementation of pilosa.TranslateEntryReader. It consolidates all index & field translate entries into a single reader.

func NewTranslateEntryReader Uses

func NewTranslateEntryReader(ctx context.Context) *TranslateEntryReader

NewTranslateEntryReader returns a new instance of TranslateEntryReader.

func (*TranslateEntryReader) Close Uses

func (r *TranslateEntryReader) Close() error

Close stops the reader.

func (*TranslateEntryReader) Open Uses

func (r *TranslateEntryReader) Open() error

Open initiates the reader.

func (*TranslateEntryReader) ReadEntry Uses

func (r *TranslateEntryReader) ReadEntry(entry *pilosa.TranslateEntry) error

ReadEntry reads the next entry from the stream into entry. Returns io.EOF at the end of the stream.

Package http imports 28 packages (graph) and is imported by 8 packages. Updated 2019-10-14. Refresh now. Tools for package owners.