package
0.0.0-20250312135022-590383e0dfc6
Repository: https://github.com/couchbase/sync_gateway.git
Documentation: pkg.go.dev
# Packages
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Copyright 2022-Present Couchbase, Inc.
No description provided by the author
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
BootstrapStartupConfigForTest returns a default config for use to start a Sync Gateway server.
CheckPermissions is used for Admin authentication to check a CBS RBAC user.
No description provided by the author
CreateAdminHandler Creates the HTTP handler for the PRIVATE admin API of a gateway server.
CreateAdminRouter Creates the HTTP handler for the PRIVATE admin API of a gateway server.
No description provided by the author
No description provided by the author
CreateMetricHandler Creates the HTTP handler for the prometheus metrics API of a gateway server.
No description provided by the author
CreatePublicHandler Creates the HTTP handler for the public API of a gateway server.
DecodeAndSanitiseStartupConfig will sanitise a config from an io.Reader and unmarshal it into the given config parameter.
DefaultDbConfig provides a DbConfig with all the default values populated.
No description provided by the author
DefaultStartupConfig returns a StartupConfig with values populated with defaults.
No description provided by the author
DocVersionFromPutResponse returns a DocRevisionID from the given response to PUT /{, or fails the given test if a rev ID was not found.
No description provided by the author
No description provided by the author
EmptyDocVersion reprents an empty document version.
No description provided by the author
No description provided by the author
No description provided by the author
GetBucketSpec returns a BucketSpec from a given DatabaseConfig and StartupConfig.
GetCollectionsConfig sets up a ScopesConfig from a TestBucket for use with non default collections.
GetCollectionsConfigWithFiltering sets up a ScopesConfig from a TestBucket for use with non default collections.
GetSingleDataStoreNamesFromScopes config returns a lexically sorted list of configured datastores.
Gets a gzip writer from the pool, or creates a new one if the pool is empty:.
No description provided by the author
No description provided by the author
GetRolePayload will take roleName and channels you want to assign a particular role and return the appropriate payload for the _role endpoint For default collection, follows same handling as GetUserPayload for chans.
No description provided by the author
GetUserPayload will take username, password, email, channels and roles you want to assign a user and create the appropriate payload for the _user endpoint.
No description provided by the author
No description provided by the author
LoadLegacyServerConfig loads a LegacyServerConfig from either a JSON file or from a URL.
No description provided by the author
No description provided by the author
No description provided by the author
MergeDatabaseConfigWithDefaults merges the passed in config onto a DefaultDbConfig which results in returned value being populated with defaults when not set.
Create a BlipTester using the default spec.
NewBlipTesterDefaultCollection creates a blip tester that has a RestTester only using a single database and `_default._default` collection.
NewBlipTesterDefaultCollectionFromSpec creates a blip tester that has a RestTester only using a single database and `_default._default` collection.
No description provided by the author
NewBlipTesterFromSpecWithRT creates a blip tester from an existing rest tester.
NewCountedResponseWriter returns a new CountedResponseWriter that wraps the given ResponseWriter.
No description provided by the author
NewDocVersionFromFakeRev returns a new DocVersion from the given fake rev ID, intended for use when we explicit create conflicts.
NewEmptyStartupConfig initialises an empty StartupConfig with all *struct fields empty.
NewEncodedResponseWriter creates a new EncodedResponseWriter, or returns nil if the request doesn't allow encoded responses.
No description provided by the author
NewHTTPTestServerOnListener returns a new httptest server, which is configured to listen on the given listener.
NewNonCountedResponseWriter returns a new NonCountedResponseWriter that wraps the given ResponseWriter.
NewReaderCounter returns a new CountedRequestReader storing the io.Reader and bytes read off the reader.
NewRegistryConfigGroup initializes an empty RegistryConfigGroup.
No description provided by the author
NewRestTester returns a rest tester and corresponding keyspace backed by a single database and a single collection.
NewRestTester returns a rest tester backed by a single database and a single default collection.
NewRestTesterForUserQueries creates a new RestTester using persistent config, and a database "db".
NewRestTester multiple collections a rest tester backed by a single database and any number of collections and the names of the keyspaces of collections created.
NewRestTesterPersistentConfig returns a rest tester with persistent config setup and a single database.
NewRouter returns a basic router for the given server type.
No description provided by the author
No description provided by the author
No description provided by the author
Reads the command line flags and the optional config file.
ParseKeyspace will return a db, scope and collection for a given '.' separated keyspace string.
PersistentConfigKey returns a document key to use to store database configs.
Return the persistent config key for a legacy 3.0 persistent config (single database per bucket model).
ReadJSONFromMIME parses a JSON MIME body, unmarshalling it into "into".
No description provided by the author
No description provided by the author
RegisterSignalHandler invokes functions based on the given signals: - SIGHUP causes Sync Gateway to rotate log files.
No description provided by the author
No description provided by the author
RequireBucketSpecificCredentials skips tests if bucket specific credentials are required.
RequireChangeRevVersion asserts that the given ChangeRev has the expected version for a given entry returned by _changes feed.
RequireDocVersionEqual calls t.Fail if two document versions are not equal.
RequireDocVersionNotEqual calls t.Fail if two document versions are equal.
RequireDocVersionNotNil calls t.Fail if two document version is not specified.
RequireGocbDCPResync skips tests if not gocb backed buckets.
RequireN1QLIndexes skips tests if N1QL indexes are required.
No description provided by the author
Closes a gzip writer and returns it to the pool:.
ServerMain is the main entry point of launching the Sync Gateway server; the main function directly calls this.
No description provided by the author
No description provided by the author
SetupServerContext creates a new ServerContext given its configuration and performs the context validation.
setupSGRPeers sets up two rest testers to be used for sg-replicate testing with the following configuration:
activeRT: - backed by test bucket - has sgreplicate enabled passiveRT: - backed by different test bucket - user 'alice' created with star channel access - http server wrapping the public API, remoteDBURLString targets the rt2 database as user alice (e.g.
StartBootstrapServer starts a server with a default bootstrap config, and returns a function to close the server.
StartBootstrapServerWithGroupID starts a server with a bootstrap config, and returns a function to close the server.
StartServer starts and runs the server with the given configuration.
StartServerWithConfig starts a server from given config, and returns a function to close the server.
TestBucketPoolRestWithIndexes is the main function that should be used for TestMain in subpackages of rest.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Wait for the WaitGroup, or return an error if the wg.Wait() doesn't return within timeout.
Writes a revision to a MIME multipart writer, encoding large attachments as separate parts.
Adds a new part to the given multipart writer, containing the given revision.
# Constants
Conflict Resolver JavaScript load.
Default value of LegacyServerConfig.MaxFileDescriptors.
Default value of LegacyServerConfig.MaxIncomingConnections.
No description provided by the author
Default number of index replicas.
No description provided by the author
No description provided by the author
Import filter JavaScript load.
No description provided by the author
PersistentConfigDefaultGroupID is used when no explicit config Group ID is defined.
restTesterDefaultUserPassword is usable as a default password for SendUserRequest.
No description provided by the author
Sync Function JavaScript load.
TestChannelTimeout can be increased to support step-through debugging.
No description provided by the author
No description provided by the author
Webhook filter JavaScript load.
# Variables
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
If set to true, diagnostic data will be dumped if there's a problem with MIME multipart data.
Only accessible on localhost!.
Disabled by default.
Only accessible on localhost!.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ErrNoStateCookie is returned by handler's handleOIDCCallback method when the state cookie is not found during OpenID Connect Auth callback.
ErrPathNotFound means that the specified path or URL (HTTP/HTTPS endpoint) doesn't exist to construct a ReadCloser to read the bytes later on.
ErrReadStateCookie is returned by handler's handleOIDCCallback method when there is failure reading state cookie value during OpenID Connect Auth callback.
ErrSGCollectInfoAlreadyRunning is returned if sgcollect_info is already running.
ErrSGCollectInfoNotRunning is returned if sgcollect_info is not running.
ErrStateMismatch is returned by handler's handleOIDCCallback method when the state cookie value doesn't match with state param in the callback URL during OpenID Connect Auth callback.
No description provided by the author
No description provided by the author
The peak number of goroutines observed during lifetime of program.
No description provided by the author
Permissions to use with admin handlers.
Permissions to use with admin handlers.
Permissions to use with admin handlers.
Permissions to use with admin handlers.
Permissions to use with admin handlers.
Permissions to use with admin handlers.
Permissions to use with admin handlers.
Permissions to use with admin handlers.
Permissions to use with admin handlers.
Permissions to use with admin handlers.
Permissions to use with admin handlers.
Permissions to use with admin handlers.
Permissions to use with admin handlers.
Permissions to use with admin handlers.
Permissions to use with admin handlers.
If set to true, JSON output will be pretty-printed.
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
State associated with a BlipTester Note that it's not safe to have multiple goroutines access a single BlipTester due to the fact that certain methods register profile handlers on the BlipContext.
The parameters used to create a BlipTester.
BootstrapConfig describes the set of properties required in order to bootstrap config from Couchbase Server.
Bucket configuration elements - used by db, index.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Cluster information, returned by _cluster_info API request.
No description provided by the author
No description provided by the author
No description provided by the author
CountedResponseWriter is an http.ResponseWriter wrapper that counts the number of bytes written in a response.
No description provided by the author
DatabaseConfig is a 3.x/persisted database config that represents a config stored in the bucket.
DatabaseInitManager coordinates InitializeDatabase requests across multiple callers and databases.
DatabaseInitOptions specifies the options used for database initialization.
DatabaseInitWorker performs async database initialization tasks that should be performed in the background, independent of the database being reloaded for config changes.
No description provided by the author
No description provided by the author
DbAuditLoggingConfig are per-db options configurable for audit logging.
DbConfig defines a database configuration used in a config file or the REST API.
DbConsoleLoggingConfig are per-db options configurable for console logging.
DbLoggingConfig allows per-database logging overrides.
No description provided by the author
No description provided by the author
Deprecated: Kept around for CBG-356 backwards compatibility.
No description provided by the author
DocVersion represents a specific version of a document in an revID/HLV agnostic manner.
EncodedResponseWriter implements of http.ResponseWriter that wraps another instance and transparently applies GZip compression when appropriate.
ErrEnvVarUndefined is returned when a specified variable can’t be resolved from the system environment and no default value is supplied in the configuration.
No description provided by the author
No description provided by the author
Helper for comparing BLIP changes received with expected BLIP changes.
No description provided by the author
No description provided by the author
GatewayRegistry lists all databases defined for the bucket, across config groups.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
JavaScriptLoadError is returned if there is any failure in loading JavaScript source from an external file or URL (HTTP/HTTPS endpoint).
JSON object that defines the server configuration.
NonCountedResponseWriter is a passhtrough http.ResponseWriter that satisfies the CoutableResponseWriter interface.
No description provided by the author
No description provided by the author
No description provided by the author
Permission stores the name of a permission along whether it is database scoped.
No description provided by the author
No description provided by the author
PrincipalConfigForWrite is used by GetUserPayload, GetRolePayload to remove the omitempty for ExplicitRoleNames and ExplicitChannels, to build payloads with explicit removal of channels and roles after changes made in CBG-3883.
PutDocResponse should be replaced with functions that return DocVersion.
No description provided by the author
RegistryConfigGroup stores the set of databases for a given config group.
RegistryDatabase stores the version and set of RegistryScopes for a database.
DatabaseVersion stores the version and collection set for a database.
RegistryScope stores the list of collections for the scope as a slice.
RemovedLegacyServerConfig are fields that used to be deprecated in a legacy config, but are now only present to log information about their removal.
No description provided by the author
RestTester provides a fake server for testing endpoints.
RestTesterConfig represents configuration for sync gateway.
ResyncPostReqBody represents Resync POST body to run resync for custom collections.
No description provided by the author
Admin API Auth Roles.
RuntimeDatabaseConfig is the non-persisted database config that has the persisted DatabaseConfig embedded.
RuntimeInformation is a struct that holds runtime-only info in without interfering or being lost inside the actual StartupConfig properties.
No description provided by the author
No description provided by the author
No description provided by the author
Shared context of HTTP handlers: primarily a registry of databases by name.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
StartupConfig is the config file used by Sync Gateway in 3.0+ to start up with node-specific settings, and then bootstrap databases via Couchbase Server.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Interfaces
ConfigManager should be used for any read/write of persisted database configuration files.
CountableResponseWriter is an interface that any custom http.ResponseWriter used by Sync Gateway handlers need to implement.
# Type aliases
CollectionInitData defines the set of collections being created (by ScopeAneCollectionName), and the set of indexes required for each collection.
No description provided by the author
No description provided by the author
JSLoadType represents a specific JavaScript load type.
No description provided by the author
No description provided by the author
No description provided by the author
Model "CouchDB" style REST documents which define the following special fields:
- _id - _rev - _removed - _deleted (not accounted for yet) - _attachments
This struct wraps a map and provides convenience methods for getting at the special fields with the appropriate types (string in the id/rev case, db.AttachmentMap in the attachments case).
No description provided by the author
No description provided by the author