wireformat.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright (C) 2014 Jakob Borg and other contributors. All rights reserved.
  2. // Use of this source code is governed by an MIT-style license that can be
  3. // found in the LICENSE file.
  4. package protocol
  5. import (
  6. "path/filepath"
  7. "code.google.com/p/go.text/unicode/norm"
  8. )
  9. type wireFormatConnection struct {
  10. next Connection
  11. }
  12. func (c wireFormatConnection) ID() string {
  13. return c.next.ID()
  14. }
  15. func (c wireFormatConnection) Index(node string, fs []FileInfo) {
  16. var myFs = make([]FileInfo, len(fs))
  17. copy(myFs, fs)
  18. for i := range fs {
  19. myFs[i].Name = norm.NFC.String(filepath.ToSlash(myFs[i].Name))
  20. }
  21. c.next.Index(node, myFs)
  22. }
  23. func (c wireFormatConnection) Request(repo, name string, offset int64, size int) ([]byte, error) {
  24. name = norm.NFC.String(filepath.ToSlash(name))
  25. return c.next.Request(repo, name, offset, size)
  26. }
  27. func (c wireFormatConnection) ClusterConfig(config ClusterConfigMessage) {
  28. c.next.ClusterConfig(config)
  29. }
  30. func (c wireFormatConnection) Statistics() Statistics {
  31. return c.next.Statistics()
  32. }