brave / go-sync

Brave sync server v2
Mozilla Public License 2.0
185 stars 44 forks source link

Release 5/13/2024 #251

Closed DJAndries closed 3 months ago

github-actions[bot] commented 3 months ago

[puLL-Merge] - brave/go-sync@251

Description

This PR updates several dependencies in the go.mod file, including the AWS SDK, golangci-lint-action, and Google protobuf. It also makes changes to the command package to enforce separate quotas for normal sync items and history-related items. The client item counts are now stored with more granular history item period counts to enable proper quota enforcement and cleanup of expired history items.

Changes ### Changes - .github/workflows/ci.yml - Updated actions/checkout, actions/setup-go, and golangci/golangci-lint-action to newer versions - command/command.go - Added separate `maxClientHistoryObjectQuota` constant and reduced `maxClientObjectQuota` - Removed `historyTypeID` constant and used `datastore.HistoryTypeID` instead - In `handleCommitRequest`: - Get separate normal and history item counts from datastore - Calculate a `boostedQuotaAddition` if history count is over quota to allow syncing other items - Treat history items differently for quota purposes - only insert if under separate history quota, otherwise ignore to let client continue syncing - Track `newNormalCount` and `newHistoryCount` separately - Pass the separate new counts when updating client item count in datastore - datastore/datastore.go - Changed `GetClientItemCount` to return a `ClientItemCounts` struct pointer - Updated `UpdateClientItemCount` to take `ClientItemCounts`, `newNormalItemCount` and `newHistoryItemCount` params - datastore/item_count.go - Renamed `ClientItemCount` struct to `ClientItemCounts` and added separate history period count fields - Added `SumHistoryCounts` method to sum the period history counts - Added `initRealCountsAndUpdateHistoryCounts` method to datastore to init real item counts from DB if needed and update period history counts - Updated `GetClientItemCount` and `UpdateClientItemCount` to use the new struct and init logic - datastore/sync_entity.go - Renamed some constants to use `HistoryTypeID` and `HistoryDeleteDirectiveTypeID` from datastore package ### Security Hotspots None. The changes do not appear to introduce any new security risks.