com.gemstone.gemfire.cache.snapshot.CacheSnapshotService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gemfire-core Show documentation
Show all versions of gemfire-core Show documentation
SnappyData store based off Pivotal GemFireXD
/*
* Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved.
*
* 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. See accompanying
* LICENSE file.
*/
package com.gemstone.gemfire.cache.snapshot;
import java.io.File;
import java.io.IOException;
import com.gemstone.gemfire.DataSerializer;
import com.gemstone.gemfire.Instantiator;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.snapshot.SnapshotOptions.SnapshotFormat;
import com.gemstone.gemfire.pdx.PdxSerializer;
/**
* Allows a snapshot of cache data to be imported and exported. Each region in
* the cache will be included in the snapshot (one snapshot file for each
* region). Example usage:
*
*
* // obtain a snapshot
* CacheSnapshotService snapshot = cache.getSnapshotService();
*
* // export the snapshot, every region in the cache will be exported
* snapshot.save(new File("."), SnapshotFormat.GEMFIRE);
*
* // import the snapshot files, updates any existing entries in the cache
* snapshot.load(new File("."), SnapshotFormat.GEMFIRE);
*
*
* The default behavior is to perform all I/O operations on the node where the
* snapshot operations are invoked. This will involve either collecting or
* dispersing data over the network if the cache contains a partitioned region.
* The snapshot behavior can be changed using {@link SnapshotOptions}. For example:
*
* CacheSnapshotService snapshot = cache.getSnapshotService();
* SnapshotFilter filter = new SnapshotFilter() {
* public boolean accept(Entry entry) {
* return true;
* }
* };
*
* SnapshotOptions
* Note that the snapshot does not provide a consistency guarantee. Updates to
* data during the course of import/export operations could result data
* inconsistencies.
*
* @see Cache#getSnapshotService()
* @see SnapshotOptions
*
* @author bakera
* @since 7.0
*/
public interface CacheSnapshotService {
/**
* Creates a SnapshotOptions
object configured with default
* settings. The options can be used to configure snapshot behavior.
*
* @return the default options
*/
SnapshotOptions