Skip to content

Commit 145e71f

Browse files
committed
*: upgrade go-borges to support metadata reload
* this versions supports reloading library metadata * if a siva library is found without metadata a new one is generated (library.yaml) * oldsiva was renamed to legacysiva * plain libraries now accept options Signed-off-by: Javi Fontan <[email protected]>
1 parent cc6a9b4 commit 145e71f

File tree

9 files changed

+26
-18
lines changed

9 files changed

+26
-18
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
### Changed
10+
11+
- `go-borges` library was updated to `0.1.1` to support metadata reloading.
12+
913
## [0.24.0-beta3] - 2019-07-31
1014

1115
### Added

_testdata/library.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
id: d4213320-c4f0-11e9-b018-9cb6d0e2bf3b
2+
version: -1

cmd/gitbase/command/server.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ import (
2525
"github.com/opentracing/opentracing-go"
2626
"github.com/sirupsen/logrus"
2727
"github.com/src-d/go-borges"
28+
"github.com/src-d/go-borges/legacysiva"
2829
"github.com/src-d/go-borges/libraries"
29-
"github.com/src-d/go-borges/oldsiva"
3030
"github.com/src-d/go-borges/plain"
3131
"github.com/src-d/go-borges/siva"
3232
sqle "github.com/src-d/go-mysql-server"
@@ -360,18 +360,18 @@ func (c *Server) addDirectory(d directory) error {
360360
RegistryCache: 100000,
361361
}
362362

363-
lib, err = siva.NewLibrary(d.Path, osfs.New(d.Path), sivaOpts)
363+
lib, err = siva.NewLibrary("", osfs.New(d.Path), sivaOpts)
364364
if err != nil {
365365
return err
366366
}
367367
} else {
368-
sivaOpts := &oldsiva.LibraryOptions{
368+
sivaOpts := &legacysiva.LibraryOptions{
369369
Cache: c.sharedCache,
370370
Bucket: d.Bucket,
371371
RegistryCache: 100000,
372372
}
373373

374-
lib, err = oldsiva.NewLibrary(d.Path, osfs.New(d.Path), sivaOpts)
374+
lib, err = legacysiva.NewLibrary(d.Path, osfs.New(d.Path), sivaOpts)
375375
if err != nil {
376376
return err
377377
}
@@ -397,7 +397,7 @@ func (c *Server) addDirectory(d directory) error {
397397
}
398398

399399
if c.plainLibrary == nil {
400-
c.plainLibrary = plain.NewLibrary(borges.LibraryID("plain"))
400+
c.plainLibrary = plain.NewLibrary(borges.LibraryID("plain"), nil)
401401
err := c.rootLibrary.Add(c.plainLibrary)
402402
if err != nil {
403403
return err

common_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,11 @@ func newMultiLibrary() (*multiLibrary, error) {
310310
if err != nil {
311311
return nil, err
312312
}
313-
plainLib := plain.NewLibrary("plain")
313+
plainLib := plain.NewLibrary("plain", nil)
314314
plainLib.AddLocation(plainLoc)
315315

316316
sivaFS := memfs.New()
317-
sivaLib, err := siva.NewLibrary("siva", sivaFS, &siva.LibraryOptions{
317+
sivaLib, err := siva.NewLibrary("", sivaFS, &siva.LibraryOptions{
318318
RootedRepo: true,
319319
})
320320
if err != nil {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ require (
1717
github.com/prometheus/client_golang v1.0.0
1818
github.com/sirupsen/logrus v1.4.2
1919
github.com/src-d/enry/v2 v2.0.0
20-
github.com/src-d/go-borges v0.0.0-20190628121335-da12a84d60fd
20+
github.com/src-d/go-borges v0.1.1
2121
github.com/src-d/go-git v4.7.0+incompatible
2222
github.com/src-d/go-git-fixtures v3.5.1-0.20190605154830-57f3972b0248+incompatible
2323
github.com/src-d/go-mysql-server v0.4.1-0.20190821121850-0e0249cf7bc0

go.sum

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
9797
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
9898
github.com/google/go-github v15.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
9999
github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
100+
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
101+
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
100102
github.com/gorilla/handlers v1.3.0/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
101103
github.com/gorilla/handlers v1.4.0 h1:XulKRWSQK5uChr4pEgSE4Tc/OcmnU9GJuSwdog/tZsA=
102104
github.com/gorilla/handlers v1.4.0/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
@@ -239,8 +241,8 @@ github.com/src-d/enry/v2 v2.0.0/go.mod h1:qQeCMRwzMF3ckeGr+h0tJLdxXnq+NVZsIDMELj
239241
github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc=
240242
github.com/src-d/gcfg v1.4.0 h1:xXbNR5AlLSA315x2UO+fTSSAXCDf+Ar38/6oyGbDKQ4=
241243
github.com/src-d/gcfg v1.4.0/go.mod h1:p/UMsR43ujA89BJY9duynAwIpvqEujIH/jFlfL7jWoI=
242-
github.com/src-d/go-borges v0.0.0-20190628121335-da12a84d60fd h1:jUbtZFWSqGX1DfD2evCwA4y7LIrWV0W8h06sjWZANf0=
243-
github.com/src-d/go-borges v0.0.0-20190628121335-da12a84d60fd/go.mod h1:Myl/zHrk3iT/I5T08RTBpuGzchucytSsi6p7KzM2lOA=
244+
github.com/src-d/go-borges v0.1.1 h1:URkX6ycDzodt5n6mAF54cdjmmAMSWIyuL12ga/E5/sM=
245+
github.com/src-d/go-borges v0.1.1/go.mod h1:q/ufK0FXUS0ngH1Crd1TyirdtUM4dl/5ky2Oxiaw4YA=
244246
github.com/src-d/go-git v4.7.0+incompatible h1:IYSSnbAHeKmsfbQFi9ozbid+KNh0bKjlorMfQehQbcE=
245247
github.com/src-d/go-git v4.7.0+incompatible/go.mod h1:1bQciz+hn0jzPQNsYj0hDFZHLJBdV7gXE2mWhC7EkFk=
246248
github.com/src-d/go-git-fixtures v3.5.1-0.20190605154830-57f3972b0248+incompatible h1:A5bKevhs9C//Nh8QV0J+1KphEaIa25cDe1DTs/yPxDI=

integration_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ import (
1010
"testing"
1111
"time"
1212

13+
"github.com/src-d/gitbase"
1314
"github.com/src-d/gitbase/cmd/gitbase/command"
15+
"github.com/src-d/gitbase/internal/function"
1416
"github.com/src-d/gitbase/internal/rule"
17+
1518
"github.com/src-d/go-borges/plain"
1619
"github.com/src-d/go-borges/siva"
17-
18-
"github.com/src-d/gitbase"
19-
"github.com/src-d/gitbase/internal/function"
2020
fixtures "github.com/src-d/go-git-fixtures"
2121
sqle "github.com/src-d/go-mysql-server"
2222
"github.com/src-d/go-mysql-server/auth"
@@ -46,7 +46,7 @@ func TestIntegration(t *testing.T) {
4646
err = os.Rename(path, pathRepo)
4747
require.NoError(t, err)
4848

49-
lib := plain.NewLibrary("plain")
49+
lib := plain.NewLibrary("plain", nil)
5050
loc, err := plain.NewLocation("location", osfs.New(pathLib), nil)
5151
require.NoError(t, err)
5252
lib.AddLocation(loc)
@@ -748,7 +748,7 @@ func TestMissingHeadRefs(t *testing.T) {
748748

749749
path := filepath.Join(cwd, "_testdata")
750750

751-
lib, err := siva.NewLibrary("siva", osfs.New(path), &siva.LibraryOptions{
751+
lib, err := siva.NewLibrary("", osfs.New(path), &siva.LibraryOptions{
752752
RootedRepo: true,
753753
})
754754
require.NoError(err)
@@ -1122,7 +1122,7 @@ func setup(t testing.TB) (*sqle.Engine, *gitbase.RepositoryPool, func()) {
11221122
err = os.Rename(path, pathRepo)
11231123
require.NoError(t, err)
11241124

1125-
lib := plain.NewLibrary("plain")
1125+
lib := plain.NewLibrary("plain", nil)
11261126
loc, err := plain.NewLocation("location", osfs.New(pathLib), nil)
11271127
require.NoError(t, err)
11281128
lib.AddLocation(loc)

internal/function/commit_stats_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func setupPool(t *testing.T) (*gitbase.RepositoryPool, func()) {
102102
err = os.Rename(path, pathRepo)
103103
require.NoError(t, err)
104104

105-
lib := plain.NewLibrary("plain")
105+
lib := plain.NewLibrary("plain", nil)
106106
loc, err := plain.NewLocation("location", osfs.New(pathLib), nil)
107107
require.NoError(t, err)
108108
lib.AddLocation(loc)

internal/function/uast_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ func setup(t *testing.T) (*sql.Context, func()) {
476476
err = os.Rename(path, pathRepo)
477477
require.NoError(t, err)
478478

479-
lib := plain.NewLibrary("plain")
479+
lib := plain.NewLibrary("plain", nil)
480480
loc, err := plain.NewLocation("location", osfs.New(pathLib), nil)
481481
require.NoError(t, err)
482482
lib.AddLocation(loc)

0 commit comments

Comments
 (0)