// Copyright 2020 The Measurement System Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package org.wfanet.measurement.common.testing

import org.wfanet.measurement.common.ExternalId
import org.wfanet.measurement.common.InternalId
import org.wfanet.measurement.common.RandomIdGenerator

/** A [RandomIdGenerator] that outputs fixed, settable IDs. */
class FixedIdGenerator : RandomIdGenerator {
  var internalId = InternalId(123456789)
  var externalId = ExternalId(987654321)

  override fun generateInternalId() = internalId

  override fun generateExternalId() = externalId
}

Add a MetricValueDatabase interface with a Google Cloud Spanner implementation.
Add a MetricValueDatabase interface with a Google Cloud Spanner implementation.

This is following the principle of ensuring that internal IDs do not leak outside of the class which implements the database interface. Therefore if we want to allow for cross-references between computation and metric value Duchy Spanner tables, we'll need to have a single class for all Spanner interaction in a Duchy.

Bug: 159036541
Change-Id: I0997be5dbfab44af281fc13d74f02ca630b2d92d

world-federation-of-advertisers/common-jvm,world-federation-of-advertisers/common-jvm