Files
Sebastian UnterschützandClaude Opus 5.5 330a3ec12c feat!: remove the rsync backend
The native libcephfs backend is the only transfer path. The rsync
transport, the mounted-filesystem access and its helpers (mount check,
path resolution below a mount, mount claim, quota and hardlink repair
through the mount) are removed, together with the rsync lab test and
the client image that only added rsync.

The claim and release tests now exercise the native claim through a
local test file system with real flock locks.

BREAKING CHANGE: "backend": "rsync" and the endpoint field "mount" are
rejected. "backend" is optional and only accepts "native"; jobs created
with "native" resume without it. Journals of rsync jobs cannot be
resumed. Builds without the build tag ceph only support doctor and
status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 22:03:22 +01:00

77 lines
1.4 KiB
Go

package migration
import (
"bytes"
"time"
bolt "go.etcd.io/bbolt"
)
type linkIndex struct {
db *bolt.DB
tx *bolt.Tx
observations int
}
func openLinkIndex(path string) (*linkIndex, error) {
// Rebuildable scratch data only: never used as a durable migration checkpoint.
db, err := bolt.Open(path, 0600, &bolt.Options{Timeout: time.Second, NoSync: true})
if err != nil {
return nil, err
}
tx, err := db.Begin(true)
if err != nil {
db.Close()
return nil, err
}
for _, name := range []string{"source", "target"} {
if _, err = tx.CreateBucket([]byte(name)); err != nil {
tx.Rollback()
db.Close()
return nil, err
}
}
return &linkIndex{db: db, tx: tx}, nil
}
func (x *linkIndex) close() error {
if x.tx != nil {
_ = x.tx.Rollback()
}
return x.db.Close()
}
func (x *linkIndex) observe(bucket string, key, value [16]byte) (bool, error) {
b := x.tx.Bucket([]byte(bucket))
old := b.Get(key[:])
same := true
if old == nil {
if err := b.Put(key[:], value[:]); err != nil {
return false, err
}
} else {
same = bytes.Equal(old, value[:])
}
x.observations++
// Limit dirty transaction state; the complete relation stays on disk.
if x.observations%4096 == 0 {
err := x.tx.Commit()
x.tx = nil
if err != nil {
return false, err
}
x.tx, err = x.db.Begin(true)
if err != nil {
return false, err
}
}
return same, nil
}