Skip to content

Commit

Permalink
Merge pull request #16 from Netflix/feature/producer-api
Browse files Browse the repository at this point in the history
High Level Producer API
  • Loading branch information
Tim Taylor authored Mar 2, 2017
2 parents d85f1b5 + f94b4dc commit 98b3480
Show file tree
Hide file tree
Showing 13 changed files with 1,592 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
*
* Copyright 2017 Netflix, Inc.
*
* 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 com.netflix.hollow.api.consumer;

import com.netflix.hollow.core.read.engine.HollowReadStateEngine;

/**
* Alpha API subject to change.
*
* @author Tim Taylor {@literal<[email protected]>}
*/
public class HollowConsumer {
public static ReadState newReadState(long version, HollowReadStateEngine stateEngine) {
return new ReadStateImpl(version, stateEngine);
}

public static interface ReadState {
long getVersion();
HollowReadStateEngine getStateEngine();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
*
* Copyright 2017 Netflix, Inc.
*
* 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 com.netflix.hollow.api.consumer;

import com.netflix.hollow.core.read.engine.HollowReadStateEngine;

/**
* Alpha API subject to change.
*
* @author Tim Taylor {@literal<[email protected]>}
*/
class ReadStateImpl implements HollowConsumer.ReadState {
private final long version;
private final HollowReadStateEngine stateEngine;



// TODO: timt: should be package protected
public ReadStateImpl(long version, HollowReadStateEngine stateEngine) {
this.version = version;
this.stateEngine = stateEngine;
}


@Override
public long getVersion() {
return version;
}

@Override
public HollowReadStateEngine getStateEngine() {
return stateEngine;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
*
* Copyright 2017 Netflix, Inc.
*
* 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 com.netflix.hollow.api.producer;

import java.util.concurrent.TimeUnit;

/**
* Beta API subject to change.
*
* @author Tim Taylor {@literal<[email protected]>}
*/
public class AbstractHollowProducerListener implements HollowProducerListener {
@Override public void onProducerInit(long elapsed, TimeUnit unit) {}

@Override public void onProducerRestoreStart(long restoreVersion) {}
@Override public void onProducerRestoreComplete(RestoreStatus status, long elapsed, TimeUnit unit) {}
@Override public void onNewDeltaChain(long version) {}

@Override public void onCycleStart(long version) {}
@Override public void onCycleComplete(ProducerStatus status, long elapsed, TimeUnit unit) {}

@Override public void onNoDeltaAvailable(long version) {}

@Override public void onPublishStart(long version) {}
@Override public void onPublishComplete(ProducerStatus status, long elapsed, TimeUnit unit) {}

@Override public void onIntegrityCheckStart(long version) {}
@Override public void onIntegrityCheckComplete(ProducerStatus status, long elapsed, TimeUnit unit) {}

@Override public void onValidationStart(long version) {}
@Override public void onValidationComplete(ProducerStatus status, long elapsed, TimeUnit unit) {}

@Override public void onAnnouncementStart(long version) {}
@Override public void onAnnouncementComplete(ProducerStatus status, long elapsed, TimeUnit unit) {}
}
Loading

0 comments on commit 98b3480

Please sign in to comment.