Update Model function signatures

This commit is contained in:
Audrius Butkevicius
2015-01-14 22:11:31 +00:00
parent 941f637bca
commit 489e2e6ad5
4 changed files with 39 additions and 39 deletions

View File

@@ -423,7 +423,7 @@ func (m *Model) NeedFolderFiles(folder string, max int) ([]db.FileInfoTruncated,
// Index is called when a new device is connected and we receive their full index.
// Implements the protocol.Model interface.
func (m *Model) Index(deviceID protocol.DeviceID, folder string, fs []protocol.FileInfo) {
func (m *Model) Index(deviceID protocol.DeviceID, folder string, fs []protocol.FileInfo, flags uint32, options []protocol.Option) {
if debug {
l.Debugf("IDX(in): %s %q: %d files", deviceID, folder, len(fs))
}
@@ -475,7 +475,7 @@ func (m *Model) Index(deviceID protocol.DeviceID, folder string, fs []protocol.F
// IndexUpdate is called for incremental updates to connected devices' indexes.
// Implements the protocol.Model interface.
func (m *Model) IndexUpdate(deviceID protocol.DeviceID, folder string, fs []protocol.FileInfo) {
func (m *Model) IndexUpdate(deviceID protocol.DeviceID, folder string, fs []protocol.FileInfo, flags uint32, options []protocol.Option) {
if debug {
l.Debugf("%v IDXUP(in): %s / %q: %d files", m, deviceID, folder, len(fs))
}
@@ -672,7 +672,7 @@ func (m *Model) Close(device protocol.DeviceID, err error) {
// Request returns the specified data segment by reading it from local disk.
// Implements the protocol.Model interface.
func (m *Model) Request(deviceID protocol.DeviceID, folder, name string, offset int64, size int) ([]byte, error) {
func (m *Model) Request(deviceID protocol.DeviceID, folder, name string, offset int64, size int, hash []byte, flags uint32, options []protocol.Option) ([]byte, error) {
if offset < 0 || size < 0 {
return nil, ErrNoSuchFile
}
@@ -975,7 +975,7 @@ func sendIndexTo(initial bool, minLocalVer int64, conn protocol.Connection, fold
if len(batch) == indexBatchSize || currentBatchSize > indexTargetSize {
if initial {
if err = conn.Index(folder, batch); err != nil {
if err = conn.Index(folder, batch, 0, nil); err != nil {
return false
}
if debug {
@@ -983,7 +983,7 @@ func sendIndexTo(initial bool, minLocalVer int64, conn protocol.Connection, fold
}
initial = false
} else {
if err = conn.IndexUpdate(folder, batch); err != nil {
if err = conn.IndexUpdate(folder, batch, 0, nil); err != nil {
return false
}
if debug {
@@ -1001,12 +1001,12 @@ func sendIndexTo(initial bool, minLocalVer int64, conn protocol.Connection, fold
})
if initial && err == nil {
err = conn.Index(folder, batch)
err = conn.Index(folder, batch, 0, nil)
if debug && err == nil {
l.Debugf("sendIndexes for %s-%s/%q: %d files (small initial index)", deviceID, name, folder, len(batch))
}
} else if len(batch) > 0 && err == nil {
err = conn.IndexUpdate(folder, batch)
err = conn.IndexUpdate(folder, batch, 0, nil)
if debug && err == nil {
l.Debugf("sendIndexes for %s-%s/%q: %d files (last batch)", deviceID, name, folder, len(batch))
}
@@ -1029,7 +1029,7 @@ func (m *Model) updateLocal(folder string, f protocol.FileInfo) {
})
}
func (m *Model) requestGlobal(deviceID protocol.DeviceID, folder, name string, offset int64, size int, hash []byte) ([]byte, error) {
func (m *Model) requestGlobal(deviceID protocol.DeviceID, folder, name string, offset int64, size int, hash []byte, flags uint32, options []protocol.Option) ([]byte, error) {
m.pmut.RLock()
nc, ok := m.protoConn[deviceID]
m.pmut.RUnlock()
@@ -1039,10 +1039,10 @@ func (m *Model) requestGlobal(deviceID protocol.DeviceID, folder, name string, o
}
if debug {
l.Debugf("%v REQ(out): %s: %q / %q o=%d s=%d h=%x", m, deviceID, folder, name, offset, size, hash)
l.Debugf("%v REQ(out): %s: %q / %q o=%d s=%d h=%x f=%x op=%s", m, deviceID, folder, name, offset, size, hash, flags, options)
}
return nc.Request(folder, name, offset, size)
return nc.Request(folder, name, offset, size, hash, flags, options)
}
func (m *Model) AddFolder(cfg config.FolderConfiguration) {