summaryrefslogtreecommitdiffstats
path: root/metrics/src/main/java/com/yahoo/metrics/util/MetricValueKeeper.java
blob: 65bd5abdd3eca01818d91232e5e2845efea37ff8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.metrics.util;

import com.yahoo.metrics.JoinBehavior;
import java.util.Collection;

/**
 *
 */
public interface MetricValueKeeper<Value> {
    /** Add a value to a given value. Used when metrics are written to by metric writer. */
    public void add(Value v);
    /** Set the value to exactly this, forgetting old value. This operation needs only be supported by value keepers used in inactive snapshots. */
    public void set(Value v);
    /** Get the value of the metrics written. If multiple values exist, use given join behavior. */
    public Value get(JoinBehavior joinBehavior);
    /** Reset the value of the metrics to zero. */
    public void reset();
    /** Return copy of current view */
    public Collection<Value> getDirectoryView();
}