func (l *internalLevelDBStore) updateRootByKey(key []byte, current, last hash.Hash) bool { l.mu.Lock() defer l.mu.Unlock() if last != l.rootByKey(key) { return false } // Sync: true write option should fsync memtable data to disk err := l.db.Put(key, []byte(current.String()), &opt.WriteOptions{Sync: true}) d.Chk.NoError(err) return true }
func (bhcs *httpBatchStore) requestRoot(method string, current, last hash.Hash) *http.Response { u := *bhcs.host u.Path = httprouter.CleanPath(bhcs.host.Path + constants.RootPath) if method == "POST" { d.Exp.False(current.IsEmpty()) params := u.Query() params.Add("last", last.String()) params.Add("current", current.String()) u.RawQuery = params.Encode() } req := newRequest(method, bhcs.auth, u.String(), nil, nil) res, err := bhcs.httpClient.Do(req) d.Chk.NoError(err) return res }
func (w *nomsTestWriter) writeHash(h hash.Hash) { w.writeString(h.String()) }
func assertInputNotInStore(input string, h hash.Hash, s ChunkStore, assert *assert.Assertions) { data := s.Get(h) assert.Nil(data, "Shouldn't have gotten data for %s", h.String()) }
func assertInputInStore(input string, h hash.Hash, s ChunkStore, assert *assert.Assertions) { chunk := s.Get(h) assert.False(chunk.IsEmpty(), "Shouldn't get empty chunk for %s", h.String()) assert.Equal(input, string(chunk.Data())) }
func CreateHashSpecString(protocol, path string, h hash.Hash) string { return fmt.Sprintf("%s:%s::#%s", protocol, path, h.String()) }