File tree 1 file changed +6
-24
lines changed
1 file changed +6
-24
lines changed Original file line number Diff line number Diff line change @@ -193,35 +193,17 @@ func (d *Datastore) Put(key ds.Key, value []byte) error {
193
193
func (d * Datastore ) Sync (prefix ds.Key ) error {
194
194
// Sync all mount points below the prefix
195
195
// Sync the mount point right at (or above) the prefix
196
- // Return ErrNoMount if no mount points are synced
197
- atLeastOneSync := false
198
- for _ , m := range d .mounts {
199
- if m .Prefix .Equal (prefix ) {
200
- if err := m .Datastore .Sync (ds .NewKey ("/" )); err != nil {
201
- return err
202
- }
203
- return nil
204
- }
205
- if m .Prefix .IsAncestorOf (prefix ) {
206
- s := strings .TrimPrefix (prefix .String (), m .Prefix .String ())
207
- k := ds .NewKey (s )
208
- if err := m .Datastore .Sync (k ); err != nil {
209
- return err
210
- }
211
- return nil
196
+ dstores , mountPts , rest := d .lookupAll (prefix )
197
+ for i , suffix := range rest {
198
+ if err := dstores [i ].Sync (suffix ); err != nil {
199
+ return err
212
200
}
213
201
214
- if m .Prefix .IsDescendantOf (prefix ) {
215
- if err := m .Datastore .Sync (ds .NewKey ("/" )); err != nil {
216
- return err
217
- }
218
- atLeastOneSync = true
202
+ if mountPts [i ].Equal (prefix ) || suffix .String () != "/" {
203
+ return nil
219
204
}
220
205
}
221
206
222
- if ! atLeastOneSync {
223
- return ErrNoMount
224
- }
225
207
return nil
226
208
}
227
209
You can’t perform that action at this time.
0 commit comments