Documentation ¶
Overview ¶
Package kindex implements an interface to compilation index files which are standalone CompilationUnits with all of their required inputs.
Example: Reading an index file.
c, err := kindex.Open("path/to/unit.kindex") if err != nil { log.Fatal(err) }
Example: Writing an index file.
var buf bytes.Buffer c.WriteTo(&buf)
On disk, a kindex file is a GZip compressed stream of varint-prefixed data blocks containing wire-format protobuf messages. The first message is a CompilationUnit, the remaining messages are FileData messages, one for each of the required inputs for the CompilationUnit.
These proto messages are defined in //kythe/proto:analysis_proto
Index ¶
Constants ¶
const Extension = ".kindex"
Standard file extension for Kythe compilation index files.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Compilation ¶
type Compilation struct { Proto *apb.CompilationUnit `json:"compilation"` Files []*apb.FileData `json:"files"` }
Compilation is a CompilationUnit with the contents for all of its required inputs.
func FromUnit ¶
func FromUnit(unit *apb.CompilationUnit, f analysis.Fetcher) (*Compilation, error)
FromUnit creates a compilation index by fetching all the required inputs of unit from f.
func New ¶
func New(r io.Reader) (*Compilation, error)
New reads a kindex file from r, which is expected to be positioned at the beginning of an index file or a data source of equivalent format.
func Open ¶
func Open(ctx context.Context, path string) (*Compilation, error)
Open opens a kindex file at the given path (using vfs.Open) and reads its contents into memory.