2014-03-28 06:36:57 -07:00
|
|
|
package protocol
|
|
|
|
|
|
|
|
import (
|
|
|
|
"path/filepath"
|
|
|
|
|
|
|
|
"code.google.com/p/go.text/unicode/norm"
|
|
|
|
)
|
|
|
|
|
|
|
|
type wireFormatConnection struct {
|
|
|
|
next Connection
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c wireFormatConnection) ID() string {
|
|
|
|
return c.next.ID()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c wireFormatConnection) Index(node string, fs []FileInfo) {
|
2014-03-29 10:53:48 -07:00
|
|
|
var myFs = make([]FileInfo, len(fs))
|
|
|
|
copy(myFs, fs)
|
|
|
|
|
2014-03-28 06:36:57 -07:00
|
|
|
for i := range fs {
|
2014-03-29 10:53:48 -07:00
|
|
|
myFs[i].Name = norm.NFC.String(filepath.ToSlash(myFs[i].Name))
|
2014-03-28 06:36:57 -07:00
|
|
|
}
|
2014-03-29 10:53:48 -07:00
|
|
|
|
|
|
|
c.next.Index(node, myFs)
|
2014-03-28 06:36:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c wireFormatConnection) Request(repo, name string, offset int64, size int) ([]byte, error) {
|
|
|
|
name = norm.NFC.String(filepath.ToSlash(name))
|
|
|
|
return c.next.Request(repo, name, offset, size)
|
|
|
|
}
|
|
|
|
|
2014-04-13 06:28:26 -07:00
|
|
|
func (c wireFormatConnection) ClusterConfig(config ClusterConfigMessage) {
|
|
|
|
c.next.ClusterConfig(config)
|
2014-03-28 06:36:57 -07:00
|
|
|
}
|
|
|
|
|
2014-04-13 06:28:26 -07:00
|
|
|
func (c wireFormatConnection) Statistics() Statistics {
|
|
|
|
return c.next.Statistics()
|
2014-03-28 06:36:57 -07:00
|
|
|
}
|