Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Side by Side Diff: common/isolated/algo.go

Issue 2422443002: isolate client: get back faster compression library. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 // Defines the algorithms used by the isolated server. 5 // Defines the algorithms used by the isolated server.
6 6
7 package isolated 7 package isolated
8 8
9 import ( 9 import (
10 "compress/zlib"
11 "crypto/sha1" 10 "crypto/sha1"
12 "hash" 11 "hash"
13 "io" 12 "io"
14 "log" 13 "log"
15 » // https://crbug.com/552697 14
16 » //"github.com/klauspost/compress/zlib" 15 » // TODO(tandrii): this library became part of Go 1.7, So, switch back to
16 » // standard library compress/zlib once we are solidly on Go > 1.7
17 » "github.com/klauspost/compress/zlib"
17 ) 18 )
18 19
19 var hashLength = sha1.New().Size() 20 var hashLength = sha1.New().Size()
20 21
21 // GetHash returns a fresh instance of the hashing algorithm to be used to 22 // GetHash returns a fresh instance of the hashing algorithm to be used to
22 // calculate the HexDigest. 23 // calculate the HexDigest.
23 // 24 //
24 // It is currently hardcoded to sha-1. 25 // It is currently hardcoded to sha-1.
25 func GetHash() hash.Hash { 26 func GetHash() hash.Hash {
26 return sha1.New() 27 return sha1.New()
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 68 }
68 return true 69 return true
69 } 70 }
70 71
71 // HexDigests is a slice of HexDigest that implements sort.Interface. 72 // HexDigests is a slice of HexDigest that implements sort.Interface.
72 type HexDigests []HexDigest 73 type HexDigests []HexDigest
73 74
74 func (h HexDigests) Len() int { return len(h) } 75 func (h HexDigests) Len() int { return len(h) }
75 func (h HexDigests) Less(i, j int) bool { return h[i] < h[j] } 76 func (h HexDigests) Less(i, j int) bool { return h[i] < h[j] }
76 func (h HexDigests) Swap(i, j int) { h[i], h[j] = h[j], h[i] } 77 func (h HexDigests) Swap(i, j int) { h[i], h[j] = h[j], h[i] }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698