protocol

package
v3.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2019 License: GPL-3.0 Imports: 24 Imported by: 3

Documentation

Overview

Package protocol is a generated protocol buffer package.

It is generated from these files:

driver.proto

It has these top-level messages:

ParseRequest
ParseResponse
ParseError
Version
Manifest
VersionRequest
VersionResponse
SupportedLanguagesRequest
SupportedLanguagesResponse

Index

Constants

View Source
const (

	// DefaultGRPCMaxMessageBytes is maximum msg size for gRPC.
	DefaultGRPCMaxMessageBytes = 100 * mb
)

Variables

View Source
var (
	ErrInvalidLengthDriver = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowDriver   = fmt.Errorf("proto: integer overflow")
)
View Source
var DevelopmentStatus_name = map[int32]string{
	0: "DEV_INACTIVE",
	1: "DEV_PLANNING",
	2: "DEV_PREALPHA",
	3: "DEV_ALPHA",
	4: "DEV_BETA",
	5: "DEV_STABLE",
	6: "DEV_MATURE",
}
View Source
var DevelopmentStatus_value = map[string]int32{
	"DEV_INACTIVE": 0,
	"DEV_PLANNING": 1,
	"DEV_PREALPHA": 2,
	"DEV_ALPHA":    3,
	"DEV_BETA":     4,
	"DEV_STABLE":   5,
	"DEV_MATURE":   6,
}
View Source
var Mode_name = map[int32]string{
	0: "DEFAULT_MODE",
	1: "NATIVE",
	2: "PREPROCESSED",
	4: "ANNOTATED",
	8: "SEMANTIC",
}
View Source
var Mode_value = map[string]int32{
	"DEFAULT_MODE": 0,
	"NATIVE":       1,
	"PREPROCESSED": 2,
	"ANNOTATED":    4,
	"SEMANTIC":     8,
}

Functions

func AsDriver

func AsDriver(cc *grpc.ClientConn) driver.Driver

AsDriver creates a v2 driver client for a given gRPC client.

func DialOptions

func DialOptions() []grpc.DialOption

DialOptions returns a set of common options that should be used when dialing bblfsh server.

It automatically enables OpenTrace if a global tracer is set.

func RegisterDriver

func RegisterDriver(srv *grpc.Server, d driver.Driver)

RegisterDriver registers a v2 driver server on a given gRPC server.

func RegisterDriverHostServer added in v3.1.0

func RegisterDriverHostServer(s *grpc.Server, srv DriverHostServer)

func RegisterDriverServer

func RegisterDriverServer(s *grpc.Server, srv DriverServer)

func ServerOptions

func ServerOptions() []grpc.ServerOption

ServerOptions returns a set of common options that should be used in bblfsh server.

It automatically enables OpenTrace if a global tracer is set.

Types

type DevelopmentStatus added in v3.1.0

type DevelopmentStatus int32
const (
	DevelopmentStatus_Inactive DevelopmentStatus = 0
	DevelopmentStatus_Planning DevelopmentStatus = 1
	DevelopmentStatus_PreAlpha DevelopmentStatus = 2
	DevelopmentStatus_Alpha    DevelopmentStatus = 3
	DevelopmentStatus_Beta     DevelopmentStatus = 4
	DevelopmentStatus_Stable   DevelopmentStatus = 5
	DevelopmentStatus_Mature   DevelopmentStatus = 6
)

func (DevelopmentStatus) EnumDescriptor added in v3.1.0

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

func (DevelopmentStatus) String added in v3.1.0

func (x DevelopmentStatus) String() string

type DriverClient

type DriverClient interface {
	// Parse returns an UAST for a given source file.
	Parse(ctx context.Context, in *ParseRequest, opts ...grpc.CallOption) (*ParseResponse, error)
}

func NewDriverClient

func NewDriverClient(cc *grpc.ClientConn) DriverClient

type DriverHostClient added in v3.1.0

type DriverHostClient interface {
	// ServerVersion returns version information of this server.
	ServerVersion(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionResponse, error)
	// SupportedLanguages returns a list of languages supported by the server.
	SupportedLanguages(ctx context.Context, in *SupportedLanguagesRequest, opts ...grpc.CallOption) (*SupportedLanguagesResponse, error)
}

func NewDriverHostClient added in v3.1.0

func NewDriverHostClient(cc *grpc.ClientConn) DriverHostClient

type DriverHostServer added in v3.1.0

type DriverHostServer interface {
	// ServerVersion returns version information of this server.
	ServerVersion(context.Context, *VersionRequest) (*VersionResponse, error)
	// SupportedLanguages returns a list of languages supported by the server.
	SupportedLanguages(context.Context, *SupportedLanguagesRequest) (*SupportedLanguagesResponse, error)
}

type DriverServer

type DriverServer interface {
	// Parse returns an UAST for a given source file.
	Parse(context.Context, *ParseRequest) (*ParseResponse, error)
}

type Manifest added in v3.1.0

type Manifest struct {
	// Name is a human-readable language or driver name.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Language is a Babelfish language identifier.
	Language string `protobuf:"bytes,2,opt,name=language,proto3" json:"language,omitempty"`
	// Aliases is a list of alternative language identifiers from Enry/Linguist.
	Aliases []string `protobuf:"bytes,3,rep,name=aliases" json:"aliases,omitempty"`
	// Version of the language driver.
	Version *Version `protobuf:"bytes,4,opt,name=version" json:"version,omitempty"`
	// Status of the driver development.
	Status DevelopmentStatus `protobuf:"varint,5,opt,name=status,proto3,enum=gopkg.in.bblfsh.sdk.v2.protocol.DevelopmentStatus" json:"status,omitempty"`
	// Features this driver supports.
	Features []string `protobuf:"bytes,6,rep,name=features" json:"features,omitempty"`
}

func NewManifest added in v3.1.0

func NewManifest(m *manifest.Manifest) *Manifest

NewManifest converts driver manifest to the corresponding protocol message.

func (*Manifest) Descriptor added in v3.1.0

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

func (*Manifest) Marshal added in v3.1.0

func (m *Manifest) Marshal() (dAtA []byte, err error)

func (*Manifest) MarshalTo added in v3.1.0

func (m *Manifest) MarshalTo(dAtA []byte) (int, error)

func (*Manifest) ProtoMessage added in v3.1.0

func (*Manifest) ProtoMessage()

func (*Manifest) ProtoSize added in v3.1.0

func (m *Manifest) ProtoSize() (n int)

func (*Manifest) Reset added in v3.1.0

func (m *Manifest) Reset()

func (*Manifest) String added in v3.1.0

func (m *Manifest) String() string

func (*Manifest) ToNative added in v3.1.0

func (m *Manifest) ToNative() *manifest.Manifest

ToNative converts the manifest message to the driver manifest used by the SDK.

func (*Manifest) Unmarshal added in v3.1.0

func (m *Manifest) Unmarshal(dAtA []byte) error

type Mode

type Mode int32
const (
	// DefaultMode selects the transformation mode that is considered to produce UAST of the best quality.
	Mode_DefaultMode Mode = 0
	// Native disables any UAST transformations and emits a native language AST as returned by the parser.
	Mode_Native Mode = 1
	// Preprocessed runs only basic transformation over native AST (normalize positional info, type fields).
	Mode_Preprocessed Mode = 2
	// Annotated UAST is based on native AST, but provides role annotations for nodes.
	Mode_Annotated Mode = 4
	// Semantic UAST normalizes native AST nodes to a unified structure where possible.
	Mode_Semantic Mode = 8
)

func (Mode) EnumDescriptor

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

func (Mode) String

func (x Mode) String() string

type ParseError

type ParseError struct {
	// Text is an error message.
	Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
}

func (*ParseError) Descriptor

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

func (*ParseError) Marshal

func (m *ParseError) Marshal() (dAtA []byte, err error)

func (*ParseError) MarshalTo

func (m *ParseError) MarshalTo(dAtA []byte) (int, error)

func (*ParseError) ProtoMessage

func (*ParseError) ProtoMessage()

func (*ParseError) ProtoSize

func (m *ParseError) ProtoSize() (n int)

func (*ParseError) Reset

func (m *ParseError) Reset()

func (*ParseError) String

func (m *ParseError) String() string

func (*ParseError) Unmarshal

func (m *ParseError) Unmarshal(dAtA []byte) error

type ParseRequest

type ParseRequest struct {
	// Content stores the content of a source file. Required.
	Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"`
	// Language can be set optionally to disable automatic language detection.
	Language string `protobuf:"bytes,2,opt,name=language,proto3" json:"language,omitempty"`
	// Filename can be set optionally to assist automatic language detection.
	Filename string `protobuf:"bytes,3,opt,name=filename,proto3" json:"filename,omitempty"`
	// Mode sets a transformation pipeline used for UAST.
	Mode Mode `protobuf:"varint,4,opt,name=mode,proto3,enum=gopkg.in.bblfsh.sdk.v2.protocol.Mode" json:"mode,omitempty"`
}

ParseRequest is a request to parse a file and get its UAST.

func (*ParseRequest) Descriptor

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

func (*ParseRequest) Marshal

func (m *ParseRequest) Marshal() (dAtA []byte, err error)

func (*ParseRequest) MarshalTo

func (m *ParseRequest) MarshalTo(dAtA []byte) (int, error)

func (*ParseRequest) ProtoMessage

func (*ParseRequest) ProtoMessage()

func (*ParseRequest) ProtoSize

func (m *ParseRequest) ProtoSize() (n int)

func (*ParseRequest) Reset

func (m *ParseRequest) Reset()

func (*ParseRequest) String

func (m *ParseRequest) String() string

func (*ParseRequest) Unmarshal

func (m *ParseRequest) Unmarshal(dAtA []byte) error

type ParseResponse

type ParseResponse struct {
	// UAST is a binary encoding of the resulting UAST.
	Uast []byte `protobuf:"bytes,1,opt,name=uast,proto3" json:"uast,omitempty"`
	// Language that was automatically detected.
	Language string `protobuf:"bytes,2,opt,name=language,proto3" json:"language,omitempty"`
	// Errors is a list of parsing errors.
	// Only set if parser was able to return a response. Otherwise gRPC error codes are used.
	Errors []*ParseError `protobuf:"bytes,3,rep,name=errors" json:"errors,omitempty"`
}

ParseResponse is the reply to ParseRequest.

func (*ParseResponse) Descriptor

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

func (*ParseResponse) Marshal

func (m *ParseResponse) Marshal() (dAtA []byte, err error)

func (*ParseResponse) MarshalTo

func (m *ParseResponse) MarshalTo(dAtA []byte) (int, error)

func (*ParseResponse) Nodes

func (m *ParseResponse) Nodes() (nodes.Node, error)

func (*ParseResponse) ProtoMessage

func (*ParseResponse) ProtoMessage()

func (*ParseResponse) ProtoSize

func (m *ParseResponse) ProtoSize() (n int)

func (*ParseResponse) Reset

func (m *ParseResponse) Reset()

func (*ParseResponse) String

func (m *ParseResponse) String() string

func (*ParseResponse) Unmarshal

func (m *ParseResponse) Unmarshal(dAtA []byte) error

type SupportedLanguagesRequest added in v3.1.0

type SupportedLanguagesRequest struct {
}

func (*SupportedLanguagesRequest) Descriptor added in v3.1.0

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

func (*SupportedLanguagesRequest) Marshal added in v3.1.0

func (m *SupportedLanguagesRequest) Marshal() (dAtA []byte, err error)

func (*SupportedLanguagesRequest) MarshalTo added in v3.1.0

func (m *SupportedLanguagesRequest) MarshalTo(dAtA []byte) (int, error)

func (*SupportedLanguagesRequest) ProtoMessage added in v3.1.0

func (*SupportedLanguagesRequest) ProtoMessage()

func (*SupportedLanguagesRequest) ProtoSize added in v3.1.0

func (m *SupportedLanguagesRequest) ProtoSize() (n int)

func (*SupportedLanguagesRequest) Reset added in v3.1.0

func (m *SupportedLanguagesRequest) Reset()

func (*SupportedLanguagesRequest) String added in v3.1.0

func (m *SupportedLanguagesRequest) String() string

func (*SupportedLanguagesRequest) Unmarshal added in v3.1.0

func (m *SupportedLanguagesRequest) Unmarshal(dAtA []byte) error

type SupportedLanguagesResponse added in v3.1.0

type SupportedLanguagesResponse struct {
	// Languages is a list of driver manifests for each language supported by the server.
	Languages []*Manifest `protobuf:"bytes,1,rep,name=languages" json:"languages,omitempty"`
}

func (*SupportedLanguagesResponse) Descriptor added in v3.1.0

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

func (*SupportedLanguagesResponse) Marshal added in v3.1.0

func (m *SupportedLanguagesResponse) Marshal() (dAtA []byte, err error)

func (*SupportedLanguagesResponse) MarshalTo added in v3.1.0

func (m *SupportedLanguagesResponse) MarshalTo(dAtA []byte) (int, error)

func (*SupportedLanguagesResponse) ProtoMessage added in v3.1.0

func (*SupportedLanguagesResponse) ProtoMessage()

func (*SupportedLanguagesResponse) ProtoSize added in v3.1.0

func (m *SupportedLanguagesResponse) ProtoSize() (n int)

func (*SupportedLanguagesResponse) Reset added in v3.1.0

func (m *SupportedLanguagesResponse) Reset()

func (*SupportedLanguagesResponse) String added in v3.1.0

func (m *SupportedLanguagesResponse) String() string

func (*SupportedLanguagesResponse) Unmarshal added in v3.1.0

func (m *SupportedLanguagesResponse) Unmarshal(dAtA []byte) error

type Version added in v3.1.0

type Version struct {
	Version string    `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
	Build   time.Time `protobuf:"bytes,2,opt,name=build,stdtime" json:"build"`
}

func (*Version) Descriptor added in v3.1.0

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

func (*Version) Marshal added in v3.1.0

func (m *Version) Marshal() (dAtA []byte, err error)

func (*Version) MarshalTo added in v3.1.0

func (m *Version) MarshalTo(dAtA []byte) (int, error)

func (*Version) ProtoMessage added in v3.1.0

func (*Version) ProtoMessage()

func (*Version) ProtoSize added in v3.1.0

func (m *Version) ProtoSize() (n int)

func (*Version) Reset added in v3.1.0

func (m *Version) Reset()

func (*Version) String added in v3.1.0

func (m *Version) String() string

func (*Version) Unmarshal added in v3.1.0

func (m *Version) Unmarshal(dAtA []byte) error

type VersionRequest added in v3.1.0

type VersionRequest struct {
}

func (*VersionRequest) Descriptor added in v3.1.0

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

func (*VersionRequest) Marshal added in v3.1.0

func (m *VersionRequest) Marshal() (dAtA []byte, err error)

func (*VersionRequest) MarshalTo added in v3.1.0

func (m *VersionRequest) MarshalTo(dAtA []byte) (int, error)

func (*VersionRequest) ProtoMessage added in v3.1.0

func (*VersionRequest) ProtoMessage()

func (*VersionRequest) ProtoSize added in v3.1.0

func (m *VersionRequest) ProtoSize() (n int)

func (*VersionRequest) Reset added in v3.1.0

func (m *VersionRequest) Reset()

func (*VersionRequest) String added in v3.1.0

func (m *VersionRequest) String() string

func (*VersionRequest) Unmarshal added in v3.1.0

func (m *VersionRequest) Unmarshal(dAtA []byte) error

type VersionResponse added in v3.1.0

type VersionResponse struct {
	Version *Version `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"`
}

func (*VersionResponse) Descriptor added in v3.1.0

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

func (*VersionResponse) Marshal added in v3.1.0

func (m *VersionResponse) Marshal() (dAtA []byte, err error)

func (*VersionResponse) MarshalTo added in v3.1.0

func (m *VersionResponse) MarshalTo(dAtA []byte) (int, error)

func (*VersionResponse) ProtoMessage added in v3.1.0

func (*VersionResponse) ProtoMessage()

func (*VersionResponse) ProtoSize added in v3.1.0

func (m *VersionResponse) ProtoSize() (n int)

func (*VersionResponse) Reset added in v3.1.0

func (m *VersionResponse) Reset()

func (*VersionResponse) String added in v3.1.0

func (m *VersionResponse) String() string

func (*VersionResponse) Unmarshal added in v3.1.0

func (m *VersionResponse) Unmarshal(dAtA []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL