Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
208 changes: 25 additions & 183 deletions Gopkg.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[[constraint]]
name = "gopkg.in/src-d/go-mysql-server.v0"
revision = "5da99c3ba25f3c637ea5dd041cf5ba73e24ac1f2"
revision = "eff16b2a86be40cb6bf6ef35801ab1eb283fd983"

[[constraint]]
name = "github.com/jessevdk/go-flags"
Expand All @@ -17,7 +17,7 @@
[[constraint]]
name = "gopkg.in/src-d/go-git.v4"
source = "github.com/src-d/go-git"
revision = "0710c6cb710a0cdab04ab7f61cc62e23cfcacbee"
revision = "cdfa0bb8d987272b5729e565dbcc64f07963d77d"

[[constraint]]
name = "gopkg.in/src-d/go-git-fixtures.v3"
Expand Down
2 changes: 1 addition & 1 deletion docs/using-gitbase/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ To make some common tasks easier for the user, there are some functions to inter

## Standard functions

You can check standard functions in [`go-mysql-server` documentation](https://github.com/src-d/go-mysql-server/tree/5da99c3ba25f3c637ea5dd041cf5ba73e24ac1f2#custom-functions).
You can check standard functions in [`go-mysql-server` documentation](https://github.com/src-d/go-mysql-server/tree/eff16b2a86be40cb6bf6ef35801ab1eb283fd983#custom-functions).
2 changes: 1 addition & 1 deletion docs/using-gitbase/indexes.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ Note that you can create an index either **on one or more columns** or **on a si

You can find some more examples in the [examples](./examples.md#create-an-index-for-columns-on-a-table) section.

See [go-mysql-server](https://github.com/src-d/go-mysql-server/tree/5da99c3ba25f3c637ea5dd041cf5ba73e24ac1f2#indexes) documentation for more details
See [go-mysql-server](https://github.com/src-d/go-mysql-server/tree/eff16b2a86be40cb6bf6ef35801ab1eb283fd983#indexes) documentation for more details
2 changes: 1 addition & 1 deletion docs/using-gitbase/supported-syntax.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## Supported syntax

To see the SQL subset currently supported take a look at [this list](https://github.com/src-d/go-mysql-server/blob/5da99c3ba25f3c637ea5dd041cf5ba73e24ac1f2/SUPPORTED.md) from [src-d/go-mysql-server](https://github.com/src-d/go-mysql-server).
To see the SQL subset currently supported take a look at [this list](https://github.com/src-d/go-mysql-server/blob/eff16b2a86be40cb6bf6ef35801ab1eb283fd983/SUPPORTED.md) from [src-d/go-mysql-server](https://github.com/src-d/go-mysql-server).
4 changes: 4 additions & 0 deletions internal/rule/squashjoins_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2531,3 +2531,7 @@ type dummyLookup struct {
func (dummyLookup) Values() (sql.IndexValueIter, error) {
panic("dummyLookup Values is a placeholder")
}

func (l dummyLookup) Indexes() []string {
return []string{fmt.Sprintf("index_%d", l.n)}
}
44 changes: 28 additions & 16 deletions packfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
)

type packRepository struct {
packs map[plumbing.Hash]packfile.Index
packs map[plumbing.Hash]idxfile.Index
}

func repositoryPackfiles(repo repository) (*dotgit.DotGit, []plumbing.Hash, error) {
Expand All @@ -44,7 +44,7 @@ func repositoryPackfiles(repo repository) (*dotgit.DotGit, []plumbing.Hash, erro

type packfileIndex struct {
packfile plumbing.Hash
idx *packfile.Index
idx idxfile.Index
}

type repositoryIndex struct {
Expand Down Expand Up @@ -74,28 +74,35 @@ func newRepositoryIndex(repo repository) (*repositoryIndex, error) {
func openPackfileIndex(
dotGit *dotgit.DotGit,
hash plumbing.Hash,
) (*packfile.Index, error) {
) (*idxfile.MemoryIndex, error) {
f, err := dotGit.ObjectPackIdx(hash)
if err != nil {
return nil, err
}
defer f.Close()

idx := idxfile.NewIdxfile()
idx := idxfile.NewMemoryIndex()
if err := idxfile.NewDecoder(f).Decode(idx); err != nil {
return nil, err
}

return packfile.NewIndexFromIdxFile(idx), nil
return idx, nil
}

var errHashNotInIndex = errors.NewKind("object hash %s is not in repository")

func (i *repositoryIndex) find(hash plumbing.Hash) (int64, plumbing.Hash, error) {
for _, idx := range i.indexes {
if entry, ok := idx.idx.LookupHash(hash); ok {
return int64(entry.Offset), idx.packfile, nil
ofs, err := idx.idx.FindOffset(hash)
if err == plumbing.ErrObjectNotFound {
continue
}

if err != nil {
return 0, plumbing.ZeroHash, err
}

return ofs, idx.packfile, nil
}

ok, err := i.isUnpacked(hash)
Expand Down Expand Up @@ -192,8 +199,8 @@ func getUnpackedObject(repo repository, hash plumbing.Hash) (o object.Object, er

type repoObjectDecoder struct {
repo string
packfile plumbing.Hash
decoder *packfile.Decoder
hash plumbing.Hash
packfile *packfile.Packfile
storage storer.EncodedObjectStorer
}

Expand Down Expand Up @@ -223,26 +230,31 @@ func newRepoObjectDecoder(
return nil, err
}

decoder, err := packfile.NewDecoder(packfile.NewScanner(packf), storage)
idx, err := openPackfileIndex(dot, hash)
if err != nil {
return nil, err
}

packfile := packfile.NewPackfile(idx, fs, packf)
if err != nil {
_ = packf.Close()
return nil, err
}

return &repoObjectDecoder{
repo: repo.ID(),
packfile: hash,
decoder: decoder,
hash: hash,
packfile: packfile,
storage: storage,
}, nil
}

func (d *repoObjectDecoder) equals(repo string, packfile plumbing.Hash) bool {
return d.repo == repo && d.packfile == packfile
func (d *repoObjectDecoder) equals(repo string, hash plumbing.Hash) bool {
return d.repo == repo && d.hash == hash
}

func (d *repoObjectDecoder) get(offset int64) (object.Object, error) {
encodedObj, err := d.decoder.DecodeObjectAt(offset)
encodedObj, err := d.packfile.GetByOffset(offset)
if err != nil {
return nil, err
}
Expand All @@ -251,7 +263,7 @@ func (d *repoObjectDecoder) get(offset int64) (object.Object, error) {
}

func (d *repoObjectDecoder) Close() error {
return d.decoder.Close()
return d.packfile.Close()
}

type objectDecoder struct {
Expand Down
4 changes: 4 additions & 0 deletions squash_iterator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1010,3 +1010,7 @@ type lookup struct {
func (l lookup) Values() (sql.IndexValueIter, error) {
return l.values, nil
}

func (l lookup) Indexes() []string {
return []string{"test_idx"}
}
48 changes: 12 additions & 36 deletions vendor/github.com/pilosa/go-pilosa/gopilosa_pbuf/public.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 31 additions & 93 deletions vendor/github.com/pilosa/pilosa/internal/private.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading