blob: 6ce1f0807714fd19a5dd23c1754af6d534581817 [file] [log] [blame]
package edu.uci.ics.hyracks.storage.am.lsm.common.impls;
import java.util.Collections;
import java.util.Set;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.api.io.FileReference;
import edu.uci.ics.hyracks.api.io.IODeviceHandle;
import edu.uci.ics.hyracks.storage.am.common.api.IndexException;
import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMComponent;
import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperation;
import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallback;
import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIndexAccessorInternal;
public class LSMFlushOperation implements ILSMIOOperation {
private final ILSMIndexAccessorInternal accessor;
private final ILSMComponent flushingComponent;
private final FileReference flushTarget;
private final ILSMIOOperationCallback callback;
public LSMFlushOperation(ILSMIndexAccessorInternal accessor, ILSMComponent flushingComponent,
FileReference flushTarget, ILSMIOOperationCallback callback) {
this.accessor = accessor;
this.flushingComponent = flushingComponent;
this.flushTarget = flushTarget;
this.callback = callback;
}
@Override
public Set<IODeviceHandle> getReadDevices() {
return Collections.emptySet();
}
@Override
public Set<IODeviceHandle> getWriteDevices() {
return Collections.singleton(flushTarget.getDeviceHandle());
}
@Override
public void perform() throws HyracksDataException, IndexException {
accessor.flush(this);
}
@Override
public ILSMIOOperationCallback getCallback() {
return callback;
}
public FileReference getFlushTarget() {
return flushTarget;
}
public ILSMIndexAccessorInternal getAccessor() {
return accessor;
}
public ILSMComponent getFlushingComponent() {
return flushingComponent;
}
}