From ede38388ad7309ef16d71ddbea94c1d5905ccf84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerhard=20St=C3=B6bich?= Date: Thu, 22 Oct 2020 15:23:48 +0200 Subject: [PATCH] fix: make TraceState immutable (#1597) --- api/src/trace/trace_state.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/api/src/trace/trace_state.ts b/api/src/trace/trace_state.ts index 074633633e5..640d1578a91 100644 --- a/api/src/trace/trace_state.ts +++ b/api/src/trace/trace_state.ts @@ -13,23 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + export interface TraceState { /** - * Adds or updates the TraceState that has the given `key` if it is - * present. The new State will always be added in the front of the - * list of states. + * Create a new TraceState which inherits from this TraceState and has the + * given key set. + * The new entry will always be added in the front of the list of states. * * @param key key of the TraceState entry. * @param value value of the TraceState entry. */ - set(key: string, value: string): void; + set(key: string, value: string): TraceState; /** - * Removes the TraceState Entry that has the given `key` if it is present. + * Return a new TraceState which inherits from this TraceState but does not + * contain the given key. * - * @param key the key for the TraceState Entry to be removed. + * @param key the key for the TraceState entry to be removed. */ - unset(key: string): void; + unset(key: string): TraceState; /** * Returns the value to which the specified key is mapped, or `undefined` if