Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

[QoS] Feature/qos client #2650

Merged
merged 9 commits into from
Nov 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions atlasdb-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dependencies {
compile group: 'javax.validation', name: 'validation-api'

compile group: 'com.palantir.remoting-api', name: 'ssl-config'
compile group: 'com.palantir.remoting3', name: 'jaxrs-clients'

processor group: 'org.immutables', name: 'value'

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the BSD-3 License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://opensource.org/licenses/BSD-3-Clause
*
* 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 com.palantir.atlasdb.qos;

public class FakeQosClient implements QosClient {

private static final FakeQosClient DEFAULT = new FakeQosClient();

public static FakeQosClient getDefault() {
return DEFAULT;
}

@Override
public void checkLimit() {
// no op
}
}
21 changes: 21 additions & 0 deletions atlasdb-api/src/main/java/com/palantir/atlasdb/qos/QosClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the BSD-3 License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://opensource.org/licenses/BSD-3-Clause
*
* 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 com.palantir.atlasdb.qos;

public interface QosClient {
void checkLimit();
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import com.palantir.atlasdb.config.LeaderConfig;
import com.palantir.atlasdb.keyvalue.api.KeyValueService;
import com.palantir.atlasdb.keyvalue.api.TableReference;
import com.palantir.atlasdb.qos.FakeQosClient;
import com.palantir.atlasdb.qos.QosClient;
import com.palantir.timestamp.TimestampService;
import com.palantir.timestamp.TimestampStoreInvalidator;

Expand All @@ -34,7 +36,8 @@ public interface AtlasDbFactory {

default KeyValueService createRawKeyValueService(
KeyValueServiceConfig config, Optional<LeaderConfig> leaderConfig) {
return createRawKeyValueService(config, leaderConfig, Optional.empty(), DEFAULT_INITIALIZE_ASYNC);
return createRawKeyValueService(config, leaderConfig, Optional.empty(), DEFAULT_INITIALIZE_ASYNC,
FakeQosClient.getDefault());
}

/**
Expand All @@ -46,13 +49,15 @@ default KeyValueService createRawKeyValueService(
* absent. If both are present, they must match.
* @param initializeAsync If the implementations supports it, and initializeAsync is true, the KVS will initialize
* asynchronously when synchronous initialization fails.
* @param qosClient the client for checking limits from the Quality-of-Service service.
* @return The requested KeyValueService instance
*/
KeyValueService createRawKeyValueService(
KeyValueServiceConfig config,
Optional<LeaderConfig> leaderConfig,
Optional<String> namespace,
boolean initializeAsync);
boolean initializeAsync,
QosClient qosClient);

default TimestampService createTimestampService(KeyValueService rawKvs) {
return createTimestampService(rawKvs, Optional.empty(), DEFAULT_INITIALIZE_ASYNC);
Expand Down
Loading