Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document improvements: optimization, refactoring #6240

Draft
wants to merge 69 commits into
base: main
Choose a base branch
from
Draft

Conversation

snej
Copy link
Contributor

@snej snej commented May 11, 2023

CBG-0000

Describe your PR here...

  • Moved document, revision, attachment code out of db into new documents package
  • DocumentRevision aids in processing incoming document bodies, allowing efficient access to special properties without ever parsing the whole body.
  • Improved attachment types, using a DocAttachment struct that marshals to/from JSON. This gets rid of a lot of code that manually reads/writes attachment properties from a raw map.
  • Reimplemented RevTree, with a new more efficient JSON format
  • Made RevTree and some other SyncData fields unmarshal themselves lazily on first use

Pre-review checklist

  • Removed debug logging (fmt.Print, log.Print, ...)
  • Logging sensitive data? Make sure it's tagged (e.g. base.UD(docID), base.MD(dbName))
  • Updated relevant information in the API specifications (such as endpoint descriptions, schemas, ...) in docs/api

Dependencies (if applicable)

  • Link upstream PRs
  • Update Go module dependencies when merged

Integration Tests

- JSONExtract now uses a callback to delegate the logic about which keys are
  special/reserved.
- implemented JSONExtract for CE
- DocumentRevision calls JSONExtract, handles special properties.
# Conflicts:
#	rest/replicatortest/replicator_test.go
Body changed to UnmarshalBody.
Removed some usages of both methods, working with JSON data instead.
- RevisionCache.GetRevision no longer returns a Body
- Removed body field from revCacheValue struct
# Conflicts:
#	rest/blip_api_delta_sync_test.go
#	rest/replicatortest/replicator_test.go
#	rest/replicatortest/replicator_test_helper.go
#	rest/user_api_test.go
#	rest/utilities_testing.go
snej and others added 29 commits March 27, 2023 15:14
# Conflicts:
#	db/access_test.go
#	db/attachment_test.go
#	db/crud.go
#	db/crud_test.go
#	db/database_test.go
#	db/revision_cache_test.go
* CBG-2894: Reject user auth when channel threshold is over 500 in serverless mode

* fix panic where authetciator was needed and it wasn't availible

* linter issue

* linter issue again

* remove extra methods off interface

* pass user into function

* rebase

* ensure 500 code is retruned for http error added

* updates based off comments

* fix panic

* updates based off comments

* updates based off dicussion yesterday

* lint error

* updates based of comments
* Add stats for transferred of bytes data ReplicationBytesReceived and ReplicationBytesSent
* Stats are updated when a BlipSyncContext exits and at a threshold set by DatabaseContextOptions.BlipStatsReportingInterval (set to thirty seconds arbitrarily to see perf impact).
Channels, Access, RoleAccess, Attachments, ChannelSet, ChannelSetHistory
are now not unmarshaled until accessed.
- Missing licenses
- An unnecessary assignment in util_ce.go
- DocumentRevision should format expiration timestamps in UTC
- Removed an unnecessary declaration from NameSet
- Also moved NameSet to base package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants