nativemodel_darwin.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright (C) 2014 Jakob Borg and Contributors (see the CONTRIBUTORS file).
  2. // All rights reserved. Use of this source code is governed by an MIT-style
  3. // license that can be found in the LICENSE file.
  4. // +build darwin
  5. package protocol
  6. // Darwin uses NFD normalization
  7. import "code.google.com/p/go.text/unicode/norm"
  8. type nativeModel struct {
  9. next Model
  10. }
  11. func (m nativeModel) Index(nodeID NodeID, repo string, files []FileInfo) {
  12. for i := range files {
  13. files[i].Name = norm.NFD.String(files[i].Name)
  14. }
  15. m.next.Index(nodeID, repo, files)
  16. }
  17. func (m nativeModel) IndexUpdate(nodeID NodeID, repo string, files []FileInfo) {
  18. for i := range files {
  19. files[i].Name = norm.NFD.String(files[i].Name)
  20. }
  21. m.next.IndexUpdate(nodeID, repo, files)
  22. }
  23. func (m nativeModel) Request(nodeID NodeID, repo string, name string, offset int64, size int) ([]byte, error) {
  24. name = norm.NFD.String(name)
  25. return m.next.Request(nodeID, repo, name, offset, size)
  26. }
  27. func (m nativeModel) ClusterConfig(nodeID NodeID, config ClusterConfigMessage) {
  28. m.next.ClusterConfig(nodeID, config)
  29. }
  30. func (m nativeModel) Close(nodeID NodeID, err error) {
  31. m.next.Close(nodeID, err)
  32. }