()
| 98 | } |
| 99 | |
| 100 | func (h *handler) handleGetCompact() error { |
| 101 | compactionType := h.getQuery("type") |
| 102 | if compactionType == "" { |
| 103 | compactionType = compactionTypeTombstone |
| 104 | } |
| 105 | |
| 106 | if compactionType != compactionTypeTombstone && compactionType != compactionTypeAttachment { |
| 107 | return base.HTTPErrorf(http.StatusBadRequest, "Unknown parameter for 'type'. Must be 'tombstone' or 'attachment'") |
| 108 | } |
| 109 | |
| 110 | auditFields := base.AuditFields{base.AuditFieldCompactionType: compactionType} |
| 111 | var status []byte |
| 112 | var err error |
| 113 | if compactionType == compactionTypeTombstone { |
| 114 | status, err = h.db.TombstoneCompactionManager.GetStatus(h.ctx()) |
| 115 | if err != nil { |
| 116 | return err |
| 117 | } |
| 118 | base.Audit(h.ctx(), base.AuditIDDatabaseCompactStatus, auditFields) |
| 119 | } |
| 120 | |
| 121 | if compactionType == compactionTypeAttachment { |
| 122 | status, err = h.db.AttachmentCompactionManager.GetStatus(h.ctx()) |
| 123 | if err != nil { |
| 124 | return err |
| 125 | } |
| 126 | base.Audit(h.ctx(), base.AuditIDDatabaseCompactStatus, auditFields) |
| 127 | } |
| 128 | |
| 129 | h.writeRawJSON(status) |
| 130 | |
| 131 | return nil |
| 132 | } |
| 133 | |
| 134 | func (h *handler) handleAttachmentMigration() error { |
| 135 | action := h.getQuery("action") |
nothing calls this directly
no test coverage detected