Skip to content

Commit

Permalink
Reorganize library layout
Browse files Browse the repository at this point in the history
Move the packages under mongo and mongo/private to core.

GODRIVER-327

Change-Id: I0d9a489dfd6e733d9714a542c62ef7844412bb33
  • Loading branch information
skriptble committed Apr 5, 2018
1 parent 854de67 commit 0783f3c
Show file tree
Hide file tree
Showing 191 changed files with 383 additions and 382 deletions.
9 changes: 4 additions & 5 deletions .errcheck-excludes
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
(github.com/mongodb/mongo-go-driver/mongo/private/conn.Connection).Close
(*github.com/mongodb/mongo-go-driver/mongo/private/roots/connection.connection).Close
(github.com/mongodb/mongo-go-driver/mongo/private/roots/connection.Connection).Close
(*github.com/mongodb/mongo-go-driver/mongo/private/roots/topology.Subscription).Unsubscribe
(*github.com/mongodb/mongo-go-driver/mongo/private/roots/topology.Server).Close
(*github.com/mongodb/mongo-go-driver/core/connection.connection).Close
(github.com/mongodb/mongo-go-driver/core/connection.Connection).Close
(*github.com/mongodb/mongo-go-driver/core/topology.Subscription).Unsubscribe
(*github.com/mongodb/mongo-go-driver/core/topology.Server).Close
16 changes: 9 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
BSON_PKGS = $(shell ./etc/find_pkgs.sh ./bson)
BSON_TEST_PKGS = $(shell ./etc/find_pkgs.sh ./bson _test)
YAMGO_PKGS = $(shell ./etc/find_pkgs.sh ./mongo)
YAMGO_TEST_PKGS = $(shell ./etc/find_pkgs.sh ./mongo _test)
PKGS = $(BSON_PKGS) $(YAMGO_PKGS)
TEST_PKGS = $(BSON_TEST_PKGS) $(YAMGO_TEST_PKGS)
MONGO_PKGS = $(shell ./etc/find_pkgs.sh ./mongo)
MONGO_TEST_PKGS = $(shell ./etc/find_pkgs.sh ./mongo _test)
CORE_PKGS = $(shell ./etc/find_pkgs.sh ./core)
CORE_TEST_PKGS = $(shell ./etc/find_pkgs.sh ./core _test)
PKGS = $(BSON_PKGS) $(MONGO_PKGS) $(CORE_PKGS)
TEST_PKGS = $(BSON_TEST_PKGS) $(MONGO_TEST_PKGS) $(CORE_TEST_PKGS)

TEST_TIMEOUT = 300

.PHONY: default
default: check-fmt vet build-examples lint errcheck test-cover test-race
default: check-fmt vet build-examples lint errcheck test-cover test-race

.PHONY: doc
doc:
godoc -http=:6060 -index

.PHONY: build-examples
build-examples:
go build $(BUILD_TAGS) ./examples/...
go build $(BUILD_TAGS) ./examples/... ./core/examples/...

.PHONY: check-fmt
check-fmt:
Expand Down Expand Up @@ -99,4 +101,4 @@ evg-test:

.PHONY: evg-test-auth
evg-test-auth:
go run -tags gssapi ./mongo/private/examples/count/main.go -uri $(MONGODB_URI)
go run -tags gssapi ./core/examples/count/main.go -uri $(MONGODB_URI)
8 changes: 4 additions & 4 deletions mongo/private/README.md → core/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# WARNING: NOT FOR PUBLIC USE

**The API for packages in `private` have no stability guarantee.**
**The API for packages in `core` have no stability guarantee.**

The packages within the `private` directory would normally be put into an
The packages within the `core` directory would normally be put into an
`internal` directory to prohibit their use outside the `mongo` directory.

However, some MongoDB tools require very low-level access to the building
blocks of a driver, so we have placed them into `private` to allow these
blocks of a driver, so we have placed them into `core` to allow these
packages to be imported by projects that need them.

These package APIs may be modified in backwards-incompatible ways at any
time.

**You are strongly discouraged from directly using any packages in
`private`.**
`core`.**
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions mongo/private/auth/auth.go → core/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import (
"context"
"fmt"

"github.com/mongodb/mongo-go-driver/mongo/private/roots/addr"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/command"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/connection"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/description"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/wiremessage"
"github.com/mongodb/mongo-go-driver/core/addr"
"github.com/mongodb/mongo-go-driver/core/command"
"github.com/mongodb/mongo-go-driver/core/connection"
"github.com/mongodb/mongo-go-driver/core/description"
"github.com/mongodb/mongo-go-driver/core/wiremessage"
)

// AuthenticatorFactory constructs an authenticator.
Expand Down
4 changes: 2 additions & 2 deletions mongo/private/auth/auth_test.go → core/auth/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"testing"

"github.com/mongodb/mongo-go-driver/bson"
. "github.com/mongodb/mongo-go-driver/mongo/private/auth"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/wiremessage"
. "github.com/mongodb/mongo-go-driver/core/auth"
"github.com/mongodb/mongo-go-driver/core/wiremessage"
"github.com/stretchr/testify/require"
)

Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions mongo/private/auth/default.go → core/auth/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ package auth
import (
"context"

"github.com/mongodb/mongo-go-driver/mongo/internal/feature"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/description"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/wiremessage"
"github.com/mongodb/mongo-go-driver/core/description"
"github.com/mongodb/mongo-go-driver/core/wiremessage"
"github.com/mongodb/mongo-go-driver/internal/feature"
)

func newDefaultAuthenticator(cred *Cred) (Authenticator, error) {
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions mongo/private/auth/gssapi.go → core/auth/gssapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (
"context"
"fmt"

"github.com/mongodb/mongo-go-driver/mongo/internal/auth/gssapi"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/description"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/wiremessage"
"github.com/mongodb/mongo-go-driver/core/auth/internal/gssapi"
"github.com/mongodb/mongo-go-driver/core/description"
"github.com/mongodb/mongo-go-driver/core/wiremessage"
)

// GSSAPI is the mechanism name for GSSAPI.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions mongo/private/auth/mongodbcr.go → core/auth/mongodbcr.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
"io"

"github.com/mongodb/mongo-go-driver/bson"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/command"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/description"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/wiremessage"
"github.com/mongodb/mongo-go-driver/core/command"
"github.com/mongodb/mongo-go-driver/core/description"
"github.com/mongodb/mongo-go-driver/core/wiremessage"
)

// MONGODBCR is the mechanism name for MONGODB-CR.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import (
"strings"

"github.com/mongodb/mongo-go-driver/bson"
. "github.com/mongodb/mongo-go-driver/mongo/private/auth"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/description"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/wiremessage"
. "github.com/mongodb/mongo-go-driver/core/auth"
"github.com/mongodb/mongo-go-driver/core/description"
"github.com/mongodb/mongo-go-driver/core/wiremessage"
)

func TestMongoDBCRAuthenticator_Fails(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions mongo/private/auth/plain.go → core/auth/plain.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"context"
"fmt"

"github.com/mongodb/mongo-go-driver/mongo/private/roots/description"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/wiremessage"
"github.com/mongodb/mongo-go-driver/core/description"
"github.com/mongodb/mongo-go-driver/core/wiremessage"
)

// PLAIN is the mechanism name for PLAIN.
Expand Down
6 changes: 3 additions & 3 deletions mongo/private/auth/plain_test.go → core/auth/plain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
"encoding/base64"

"github.com/mongodb/mongo-go-driver/bson"
. "github.com/mongodb/mongo-go-driver/mongo/private/auth"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/description"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/wiremessage"
. "github.com/mongodb/mongo-go-driver/core/auth"
"github.com/mongodb/mongo-go-driver/core/description"
"github.com/mongodb/mongo-go-driver/core/wiremessage"
)

func TestPlainAuthenticator_Fails(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions mongo/private/auth/sasl.go → core/auth/sasl.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"context"

"github.com/mongodb/mongo-go-driver/bson"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/command"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/description"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/wiremessage"
"github.com/mongodb/mongo-go-driver/core/command"
"github.com/mongodb/mongo-go-driver/core/description"
"github.com/mongodb/mongo-go-driver/core/wiremessage"
)

// SaslClient is the client piece of a sasl conversation.
Expand Down
4 changes: 2 additions & 2 deletions mongo/private/auth/scramsha1.go → core/auth/scramsha1.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (
"math/rand"
"strconv"

"github.com/mongodb/mongo-go-driver/mongo/private/roots/description"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/wiremessage"
"github.com/mongodb/mongo-go-driver/core/description"
"github.com/mongodb/mongo-go-driver/core/wiremessage"
"golang.org/x/crypto/pbkdf2"

"strings"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
"encoding/base64"

"github.com/mongodb/mongo-go-driver/bson"
. "github.com/mongodb/mongo-go-driver/mongo/private/auth"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/description"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/wiremessage"
. "github.com/mongodb/mongo-go-driver/core/auth"
"github.com/mongodb/mongo-go-driver/core/description"
"github.com/mongodb/mongo-go-driver/core/wiremessage"
"github.com/stretchr/testify/require"
)

Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions mongo/private/auth/x509.go → core/auth/x509.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"context"

"github.com/mongodb/mongo-go-driver/bson"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/command"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/description"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/wiremessage"
"github.com/mongodb/mongo-go-driver/core/command"
"github.com/mongodb/mongo-go-driver/core/description"
"github.com/mongodb/mongo-go-driver/core/wiremessage"
)

// MongoDBX509 is the mechanism name for MongoDBX509.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"context"

"github.com/mongodb/mongo-go-driver/bson"
"github.com/mongodb/mongo-go-driver/mongo/private/options"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/description"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/wiremessage"
"github.com/mongodb/mongo-go-driver/mongo/readpref"
"github.com/mongodb/mongo-go-driver/core/description"
"github.com/mongodb/mongo-go-driver/core/options"
"github.com/mongodb/mongo-go-driver/core/readpref"
"github.com/mongodb/mongo-go-driver/core/wiremessage"
)

// Aggregate represents the aggregate command.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"

"github.com/mongodb/mongo-go-driver/bson"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/description"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/wiremessage"
"github.com/mongodb/mongo-go-driver/core/description"
"github.com/mongodb/mongo-go-driver/core/wiremessage"
)

// Bootstrap represents a command used for bootstrapping such as isMaster,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"

"github.com/mongodb/mongo-go-driver/bson"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/result"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/wiremessage"
"github.com/mongodb/mongo-go-driver/core/result"
"github.com/mongodb/mongo-go-driver/core/wiremessage"
)

// BuildInfo represents the buildInfo command.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (

"github.com/mongodb/mongo-go-driver/bson"
"github.com/mongodb/mongo-go-driver/bson/builder"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/description"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/wiremessage"
"github.com/mongodb/mongo-go-driver/mongo/readpref"
"github.com/mongodb/mongo-go-driver/core/description"
"github.com/mongodb/mongo-go-driver/core/readpref"
"github.com/mongodb/mongo-go-driver/core/wiremessage"
)

// Command represents a generic database command.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"errors"

"github.com/mongodb/mongo-go-driver/bson"
"github.com/mongodb/mongo-go-driver/mongo/private/options"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/description"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/wiremessage"
"github.com/mongodb/mongo-go-driver/mongo/readpref"
"github.com/mongodb/mongo-go-driver/core/description"
"github.com/mongodb/mongo-go-driver/core/options"
"github.com/mongodb/mongo-go-driver/core/readpref"
"github.com/mongodb/mongo-go-driver/core/wiremessage"
)

// Count represents the count command.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"

"github.com/mongodb/mongo-go-driver/bson"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/description"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/result"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/wiremessage"
"github.com/mongodb/mongo-go-driver/core/description"
"github.com/mongodb/mongo-go-driver/core/result"
"github.com/mongodb/mongo-go-driver/core/wiremessage"
)

// CreateIndexes represents the createIndexes command.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"

"github.com/mongodb/mongo-go-driver/bson"
"github.com/mongodb/mongo-go-driver/mongo/private/options"
"github.com/mongodb/mongo-go-driver/core/options"
)

// Cursor instances iterate a stream of documents. Each document is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"context"

"github.com/mongodb/mongo-go-driver/bson"
"github.com/mongodb/mongo-go-driver/mongo/private/options"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/description"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/result"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/wiremessage"
"github.com/mongodb/mongo-go-driver/core/description"
"github.com/mongodb/mongo-go-driver/core/options"
"github.com/mongodb/mongo-go-driver/core/result"
"github.com/mongodb/mongo-go-driver/core/wiremessage"
)

// Delete represents the delete command.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"context"

"github.com/mongodb/mongo-go-driver/bson"
"github.com/mongodb/mongo-go-driver/mongo/private/options"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/description"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/result"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/wiremessage"
"github.com/mongodb/mongo-go-driver/mongo/readpref"
"github.com/mongodb/mongo-go-driver/core/description"
"github.com/mongodb/mongo-go-driver/core/options"
"github.com/mongodb/mongo-go-driver/core/readpref"
"github.com/mongodb/mongo-go-driver/core/result"
"github.com/mongodb/mongo-go-driver/core/wiremessage"
)

// Distinct represents the disctinct command.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"

"github.com/mongodb/mongo-go-driver/bson"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/description"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/wiremessage"
"github.com/mongodb/mongo-go-driver/core/description"
"github.com/mongodb/mongo-go-driver/core/wiremessage"
)

// DropIndexes represents the dropIndexes command.
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions mongo/private/roots/command/find.go → core/command/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"context"

"github.com/mongodb/mongo-go-driver/bson"
"github.com/mongodb/mongo-go-driver/mongo/private/options"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/description"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/wiremessage"
"github.com/mongodb/mongo-go-driver/mongo/readpref"
"github.com/mongodb/mongo-go-driver/core/description"
"github.com/mongodb/mongo-go-driver/core/options"
"github.com/mongodb/mongo-go-driver/core/readpref"
"github.com/mongodb/mongo-go-driver/core/wiremessage"
)

// Find represents the find command.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"errors"

"github.com/mongodb/mongo-go-driver/bson"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/result"
"github.com/mongodb/mongo-go-driver/core/result"
)

// unmarshalFindAndModifyResult turns the provided bson.Reader into a findAndModify result.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"context"

"github.com/mongodb/mongo-go-driver/bson"
"github.com/mongodb/mongo-go-driver/mongo/private/options"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/description"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/result"
"github.com/mongodb/mongo-go-driver/mongo/private/roots/wiremessage"
"github.com/mongodb/mongo-go-driver/core/description"
"github.com/mongodb/mongo-go-driver/core/options"
"github.com/mongodb/mongo-go-driver/core/result"
"github.com/mongodb/mongo-go-driver/core/wiremessage"
)

// FindOneAndDelete represents the findOneAndDelete operation.
Expand Down
Loading

0 comments on commit 0783f3c

Please sign in to comment.