From fccddbf4ae83046fb2e4ba1b9098c2707941ece1 Mon Sep 17 00:00:00 2001 From: Philip O'Toole Date: Sat, 6 Jan 2024 00:48:15 -0500 Subject: [PATCH] Support compressing backups --- http/query_params.go | 5 +++++ http/service.go | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/http/query_params.go b/http/query_params.go index 1d60b7b1..8f7e4f3d 100644 --- a/http/query_params.go +++ b/http/query_params.go @@ -103,6 +103,11 @@ func (qp QueryParams) Vacuum() bool { return qp.HasKey("vacuum") } +// Compress returns true if the query parameters request compression. +func (qp QueryParams) Compress() bool { + return qp.HasKey("compress") +} + // Key returns the value of the key named "key". func (qp QueryParams) Key() string { return qp["key"] diff --git a/http/service.go b/http/service.go index 67bf1fe1..a1db4df9 100644 --- a/http/service.go +++ b/http/service.go @@ -600,9 +600,10 @@ func (s *Service) handleBackup(w http.ResponseWriter, r *http.Request, qp QueryP } br := &proto.BackupRequest{ - Format: qp.BackupFormat(), - Leader: !qp.NoLeader(), - Vacuum: qp.Vacuum(), + Format: qp.BackupFormat(), + Leader: !qp.NoLeader(), + Vacuum: qp.Vacuum(), + Compress: qp.Compress(), } addBackupFormatHeader(w, qp)