"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "server/etcdserver/quota.go" between
etcd-3.5.6.tar.gz and etcd-3.5.7.tar.gz

About: etcd is a distributed reliable key-value store for the most critical data of a distributed system (written in "Go").

quota.go  (etcd-3.5.6):quota.go  (etcd-3.5.7)
skipping to change at line 128 skipping to change at line 128
"enabled backend quota", "enabled backend quota",
zap.String("quota-name", name), zap.String("quota-name", name),
zap.Int64("quota-size-bytes", s.Cfg.QuotaBackendBytes), zap.Int64("quota-size-bytes", s.Cfg.QuotaBackendBytes),
zap.String("quota-size", humanize.Bytes(uint64(s.Cfg.Quot aBackendBytes))), zap.String("quota-size", humanize.Bytes(uint64(s.Cfg.Quot aBackendBytes))),
) )
}) })
return &backendQuota{s, s.Cfg.QuotaBackendBytes} return &backendQuota{s, s.Cfg.QuotaBackendBytes}
} }
func (b *backendQuota) Available(v interface{}) bool { func (b *backendQuota) Available(v interface{}) bool {
cost := b.Cost(v)
// if there are no mutating requests, it's safe to pass through
if cost == 0 {
return true
}
// TODO: maybe optimize backend.Size() // TODO: maybe optimize backend.Size()
return b.s.Backend().Size()+int64(b.Cost(v)) < b.maxBackendBytes return b.s.Backend().Size()+int64(cost) < b.maxBackendBytes
} }
func (b *backendQuota) Cost(v interface{}) int { func (b *backendQuota) Cost(v interface{}) int {
switch r := v.(type) { switch r := v.(type) {
case *pb.PutRequest: case *pb.PutRequest:
return costPut(r) return costPut(r)
case *pb.TxnRequest: case *pb.TxnRequest:
return costTxn(r) return costTxn(r)
case *pb.LeaseGrantRequest: case *pb.LeaseGrantRequest:
return leaseOverhead return leaseOverhead
 End of changes. 2 change blocks. 
1 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)