1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.adservices.data.signals; 18 19 import android.adservices.common.AdTechIdentifier; 20 21 import androidx.room.Dao; 22 import androidx.room.Insert; 23 import androidx.room.OnConflictStrategy; 24 import androidx.room.Query; 25 26 /** Dao to register, access and update encoder endpoints for buyers */ 27 @Dao 28 public interface EncoderEndpointsDao { 29 30 /** 31 * @param endpoint an entry containing endpoint for an encoder 32 * @return the rowId of the entry persisted 33 */ 34 @Insert(onConflict = OnConflictStrategy.REPLACE) registerEndpoint(DBEncoderEndpoint endpoint)35 long registerEndpoint(DBEncoderEndpoint endpoint); 36 37 /** 38 * @param buyer Ad-tech whose encoder we will fetch from the endpoint 39 * @return an instance of {@link DBEncoderEndpoint} if present 40 */ 41 @Query("SELECT * FROM encoder_endpoints WHERE buyer = :buyer") getEndpoint(AdTechIdentifier buyer)42 DBEncoderEndpoint getEndpoint(AdTechIdentifier buyer); 43 44 /** 45 * @param buyer Ad-tech identifier whose encoder endpoint we want to delete 46 */ 47 @Query("DELETE FROM encoder_endpoints WHERE buyer = :buyer") deleteEncoderEndpoint(AdTechIdentifier buyer)48 void deleteEncoderEndpoint(AdTechIdentifier buyer); 49 } 50