Documentation
¶
Index ¶
- Constants
- func EncodePrimaryKey(value bson.RawValue) ([]byte, error)
- type ClusterCatalogVersionProvider
- type ServeBuffers
- type Server
- func (s *Server) Close() error
- func (s *Server) ListenAndServe(ctx context.Context, addr string) error
- func (s *Server) Serve(ctx context.Context, ln net.Listener) error
- func (s *Server) ServeConn(ctx context.Context, conn net.Conn) error
- func (s *Server) ServeOne(rw io.ReadWriter) error
- func (s *Server) ServeOneWithOwner(rw io.ReadWriter, cursorOwner int64) error
- func (s *Server) ServeOneWithOwnerBuffered(rw io.ReadWriter, cursorOwner int64, buffers *ServeBuffers) error
- type StandaloneOptions
- type StandaloneServer
Constants ¶
const ( DefaultStandaloneAddr = "127.0.0.1:27017" DefaultStandaloneDocumentFormat = collections.DocumentFormatBSON )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ServeBuffers ¶
type ServeBuffers struct {
// contains filtered or unexported fields
}
ServeBuffers holds reusable per-connection buffers for callers that dispatch individual wire messages without using ServeConn.
ServeBuffers is not safe for concurrent use. Use one instance per logical connection/worker.
type Server ¶
type Server struct {
MaxMessageLength int32
MaxFindScanDocuments int
MaxCursorRetainedBytes int
MaxOpenCursors int
CursorIdleTimeout time.Duration
// UpdateCoalescingMaxDelay waits for additional same-collection update
// commands before publishing a batch. Zero means only coalesce already-queued
// work; negative disables coalescing.
UpdateCoalescingMaxDelay time.Duration
// UpdateCoalescingMaxBatch caps one coalesced same-collection update publish.
// Values above maxUpdateCoalescingBatch are clamped.
UpdateCoalescingMaxBatch int
// UpdateCoalescingIdleTTL removes an idle per-collection coalescer after this
// duration. Zero uses the default; negative disables idle removal.
UpdateCoalescingIdleTTL time.Duration
// InsertCoalescingMaxDelay waits for additional same-collection single-document
// BSON insert commands before publishing a batch. Zero means only coalesce
// already-queued work; negative disables coalescing.
InsertCoalescingMaxDelay time.Duration
// InsertCoalescingMaxBatch caps one coalesced same-collection insert publish.
// Values above maxInsertCoalescingBatch are clamped.
InsertCoalescingMaxBatch int
// InsertCoalescingIdleTTL removes an idle per-collection coalescer after this
// duration. Zero uses the default; negative disables idle removal.
InsertCoalescingIdleTTL time.Duration
Collections *collections.CollectionManager
DefaultCollectionOptions collections.CollectionOptions
DefaultIndexStoragePolicy collections.RootStoragePolicy
ClusterSubmitter treenativewire.ClusterSubmitter
ClusterCatalogVersion ClusterCatalogVersionProvider
// ClusterIdempotencyNonce scopes generated cluster mutation idempotency
// keys to one gateway process epoch. NewServer initializes a random nonce
// so sequence-based keys are not reused after restart.
ClusterIdempotencyNonce string
// contains filtered or unexported fields
}
func (*Server) ListenAndServe ¶
ListenAndServe listens on addr and serves MongoDB wire-protocol clients.
func (*Server) Serve ¶
Serve accepts MongoDB wire-protocol connections on ln until ctx is canceled, ln is closed, or the gateway returns an accept error. Serve owns ln and closes it before returning.
func (*Server) ServeOne ¶
func (s *Server) ServeOne(rw io.ReadWriter) error
ServeOne serves a single MongoDB wire message with a one-shot cursor owner. Callers serving a real long-lived connection should use ServeOneWithOwner or ServeConn so cursors survive across getMore/killCursors commands on the same connection owner.
func (*Server) ServeOneWithOwner ¶
func (s *Server) ServeOneWithOwner(rw io.ReadWriter, cursorOwner int64) error
func (*Server) ServeOneWithOwnerBuffered ¶
func (s *Server) ServeOneWithOwnerBuffered(rw io.ReadWriter, cursorOwner int64, buffers *ServeBuffers) error
ServeOneWithOwnerBuffered serves one MongoDB wire message with caller-owned reusable buffers. It is intended for in-process dispatchers and benchmarks that need the same buffer reuse behavior as ServeConn.
type StandaloneOptions ¶
type StandaloneOptions struct {
Dir string
Profile treedb.Profile
DefaultCollectionOptions collections.CollectionOptions
DefaultIndexStoragePolicy collections.RootStoragePolicy
MaxMessageLength int32
MaxFindScanDocuments int
MaxCursorRetainedBytes int
MaxOpenCursors int
CursorIdleTimeout time.Duration
UpdateCoalescingMaxDelay time.Duration
// UpdateCoalescingMaxBatchSet distinguishes an unset zero value from an
// explicit zero, which disables update coalescing.
UpdateCoalescingMaxBatchSet bool
UpdateCoalescingMaxBatch int
UpdateCoalescingIdleTTL time.Duration
InsertCoalescingMaxDelay time.Duration
// InsertCoalescingMaxBatchSet distinguishes an unset zero value from an
// explicit zero, which disables insert coalescing.
InsertCoalescingMaxBatchSet bool
InsertCoalescingMaxBatch int
InsertCoalescingIdleTTL time.Duration
ClusterSubmitter treenativewire.ClusterSubmitter
ClusterCatalogVersion ClusterCatalogVersionProvider
}
StandaloneOptions configures a TreeDB-backed MongoDB gateway process.
The standalone server intentionally exposes a small MongoDB-compatible subset implemented by Server. It is suitable for local clients and benchmarks, not for claiming full MongoDB feature parity.
func NormalizeStandaloneOptions ¶
func NormalizeStandaloneOptions(opts StandaloneOptions) (StandaloneOptions, error)
NormalizeStandaloneOptions applies standalone defaults and validates options.
type StandaloneServer ¶
type StandaloneServer struct {
Options StandaloneOptions
Backend *backenddb.DB
Collections *collections.CollectionManager
Server *Server
// contains filtered or unexported fields
}
StandaloneServer owns the TreeDB backend, collection manager, and MongoDB gateway server used by the standalone gateway executable.
func OpenStandaloneServer ¶
func OpenStandaloneServer(opts StandaloneOptions) (*StandaloneServer, error)
OpenStandaloneServer opens TreeDB and returns a standalone MongoDB gateway.
func (*StandaloneServer) Close ¶
func (s *StandaloneServer) Close() error
Close stops active MongoDB connections and closes the TreeDB backend. It is safe to call multiple times.
func (*StandaloneServer) ListenAndServe ¶
func (s *StandaloneServer) ListenAndServe(ctx context.Context, addr string) error
ListenAndServe listens on addr and serves MongoDB clients for a standalone TreeDB gateway.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package fastclient provides a narrow, low-overhead client for bulk inserts into the TreeDB Mongo gateway.
|
Package fastclient provides a narrow, low-overhead client for bulk inserts into the TreeDB Mongo gateway. |