Compare commits

..

4 Commits

Author SHA1 Message Date
Christian Schwarz 3de3e2b688 WIP: draft incomplete keep rule for keeping most recent common ancestor 2020-02-17 17:46:31 +01:00
Christian Schwarz 3edfe535c6 docs: fix typo on index page 2019-10-05 14:59:51 +02:00
Juergen Hoetzel d3b99e8e39 Fix typo 2019-10-05 14:58:49 +02:00
Christian Schwarz 3c03f21419 docs: SEPA hint, supporters, fix publish script 2019-10-03 11:57:19 +02:00
10 changed files with 71 additions and 6 deletions
+1
View File
@@ -26,6 +26,7 @@ jobs:
- type: last_n - type: last_n
count: 10 count: 10
keep_receiver: keep_receiver:
- type: most_recent_common_snapshot
- type: grid - type: grid
grid: 1x1h(keep=all) | 24x1h | 35x1d | 6x30d grid: 1x1h(keep=all) | 24x1h | 35x1d | 6x30d
regex: "zrepl_.*" regex: "zrepl_.*"
+2 -1
View File
@@ -56,7 +56,8 @@ We use the following annotations for classifying changes:
| zrepl is a spare-time project primarily developed by `Christian Schwarz <https://cschwarz.com>`_. | zrepl is a spare-time project primarily developed by `Christian Schwarz <https://cschwarz.com>`_.
| You can support maintenance and feature development through one of the following services: | You can support maintenance and feature development through one of the following services:
| |Donate via Patreon| |Donate via Liberapay| |Donate via PayPal| | |Donate via Patreon| |Donate via Liberapay| |Donate via PayPal|
| For commerical support, please `contact Christian directly <https://cschwarz.com>`_. | Note that PayPal processing fees are relatively high for small donations.
| For SEPA wire transfer and **commerical support**, please `contact Christian directly <https://cschwarz.com>`_.
0.1.1 0.1.1
+1 -1
View File
@@ -52,7 +52,7 @@ Main Features
* **Filesystem replication** * **Filesystem replication**
* [x] Pull & Push mode * [x] Pull & Push mode
* [x] Multiple transport :ref:`transports <transport>`: TCP, TCP + TLS client auth, SSH * [x] Multiple :ref:`transport modes <transport>`: TCP, TCP + TLS client auth, SSH
* Advanced replication features * Advanced replication features
+2 -2
View File
@@ -55,8 +55,8 @@ set -e
sphinx-versioning build \ sphinx-versioning build \
--show-banner \ --show-banner \
--whitelist-branches '^master$' \ --whitelist-branches '^master$' \
--whitelist-tags '(v)?\d+\.\d+\.\d+$' \ --whitelist-tags '(v)?\d+\.[1-9][0-9]*.\d+$' \
--whitelist-tags '(v)?0.1.0-rc(3|4)$' \ --whitelist-tags '(v)?0.2.0-rc.*$' \
docs ./public_git \ docs ./public_git \
-- -c sphinxconf # older conf.py throw errors because they used -- -c sphinxconf # older conf.py throw errors because they used
# version = subprocess.show_output(["git", "describe"]) # version = subprocess.show_output(["git", "describe"])
+2 -1
View File
@@ -6,7 +6,7 @@
zrepl is a spare-time project primarily developed by `Christian Schwarz <https://cschwarz.com>`_. zrepl is a spare-time project primarily developed by `Christian Schwarz <https://cschwarz.com>`_.
You can support maintenance and feature development through one of the services listed above. You can support maintenance and feature development through one of the services listed above.
For commerical support, please `contact Christian directly <https://cschwarz.com>`_. For SEPA wire transfer and **commerical support**, please `contact Christian directly <https://cschwarz.com>`_.
**Thanks for your support!** **Thanks for your support!**
@@ -20,6 +20,7 @@ Supporters
We would like to thank the following people / organizations for supporting zrepl through monetary and other means: We would like to thank the following people / organizations for supporting zrepl through monetary and other means:
* `Marshall Clyburn <https://github.com/mdclyburn>`_
* `Ross Williams <https://github.com/overhacked>`_ * `Ross Williams <https://github.com/overhacked>`_
* Mike T. * Mike T.
* `Justin Scholz <https://github.com/JMoVS>`_ * `Justin Scholz <https://github.com/JMoVS>`_
+1 -1
View File
@@ -96,7 +96,7 @@ We define a **push job** named ``prod_to_backups`` in ``/etc/zrepl/zrepl.yml`` o
key: /etc/zrepl/prod.key key: /etc/zrepl/prod.key
server_cn: "backups" server_cn: "backups"
filesystems: { filesystems: {
"zroot/var/db:": true, "zroot/var/db": true,
"zroot/usr/home<": true, "zroot/usr/home<": true,
"zroot/usr/home/paranoid": false "zroot/usr/home/paranoid": false
} }
@@ -0,0 +1,29 @@
package pruning
import "sort"
type KeepMostRecentCommonAncestor struct {
_opaque struct{}
}
func NewKeepMostRecentCommonAncestor() *KeepMostRecentCommonAncestor {
return &KeepMostRecentCommonAncestor{}
}
func (k *KeepMostRecentCommonAncestor) KeepRule(snaps []Snapshot) (destroyList []Snapshot) {
var bothSides []Snapshot
for _, s := range snaps {
if s.PresentOnBothSides() {
bothSides = append(bothSides, s)
}
}
if len(bothSides) == 0 {
return []Snapshot{}
}
sort.Slice(bothSides, func(i, j int) bool {
return bothSides[i].Date().After(bothSides[j].Date())
})
return []Snapshot{bothSides[0]}
}
@@ -0,0 +1,31 @@
package pruning
import "testing"
func TestKeppMostRecentCommonAncestor(t *testing.T) {
o := func(minutes int) time.Time {
return time.Unix(123, 0).Add(time.Duration(minutes) * time.Minute)
}
tcs := map[string]testCase{
"empty": {
inputs: []Snapshot{},
rules: []KeepRule{NewKeepMostRecentCommonAncestor()},
expDestroy: map[string]bool{},
},
"nil": {
inputs: nil,
rules: []KeepRule{NewKeepMostRecentCommonAncestor()},
expDestroy: map[string]bool{},
},
"": {
inputs: []Snapshot{
stubSnap{name: "s1", date: o(5), bothSides: }
},
}
}
testTable(tcs, t)
}
+1
View File
@@ -17,6 +17,7 @@ type Snapshot interface {
Name() string Name() string
Replicated() bool Replicated() bool
Date() time.Time Date() time.Time
PresentOnBothSides() bool
} }
// The returned snapshot list is guaranteed to only contains elements of input parameter snaps // The returned snapshot list is guaranteed to only contains elements of input parameter snaps
+1
View File
@@ -9,6 +9,7 @@ type stubSnap struct {
name string name string
replicated bool replicated bool
date time.Time date time.Time
bothSides bool
} }
func (s stubSnap) Name() string { return s.name } func (s stubSnap) Name() string { return s.name }