Skip to content

Commit

Permalink
Moved o.n.k.i.s.StoreId to o.n.storageengine.api
Browse files Browse the repository at this point in the history
  • Loading branch information
tinwelint committed Aug 10, 2018
1 parent 49d3b9b commit ad3f86a
Show file tree
Hide file tree
Showing 90 changed files with 108 additions and 111 deletions.
Expand Up @@ -57,9 +57,9 @@
import org.neo4j.kernel.api.Statement;
import org.neo4j.kernel.impl.core.ThreadToStatementContextBridge;
import org.neo4j.kernel.impl.coreapi.InternalTransaction;
import org.neo4j.kernel.impl.store.StoreId;
import org.neo4j.kernel.internal.GraphDatabaseAPI;
import org.neo4j.kernel.monitoring.Monitors;
import org.neo4j.storageengine.api.StoreId;

import static org.neo4j.helpers.collection.MapUtil.stringMap;

Expand Down
Expand Up @@ -27,10 +27,10 @@

import org.neo4j.jmx.Kernel;
import org.neo4j.kernel.NeoStoreDataSource;
import org.neo4j.kernel.impl.store.StoreId;
import org.neo4j.kernel.impl.transaction.log.LogVersionRepository;
import org.neo4j.kernel.impl.transaction.state.DataSourceManager;
import org.neo4j.kernel.internal.KernelData;
import org.neo4j.storageengine.api.StoreId;

public class KernelBean extends Neo4jMBean implements Kernel
{
Expand Down
Expand Up @@ -27,7 +27,6 @@
import org.neo4j.internal.kernel.api.exceptions.schema.ConstraintValidationException;
import org.neo4j.io.pagecache.IOLimiter;
import org.neo4j.kernel.api.exceptions.schema.CreateConstraintFailureException;
import org.neo4j.kernel.impl.store.StoreId;
import org.neo4j.storageengine.api.lock.ResourceLocker;
import org.neo4j.storageengine.api.txstate.ReadableTransactionState;
import org.neo4j.storageengine.api.txstate.TxStateVisitor;
Expand Down
Expand Up @@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.kernel.impl.store;
package org.neo4j.storageengine.api;

import java.io.Externalizable;
import java.io.IOException;
Expand All @@ -28,7 +28,6 @@

public final class StoreId implements Externalizable
{

public static final StoreId DEFAULT = new StoreId( -1, -1, -1, -1, -1 );

private static final Random r = new SecureRandom();
Expand Down
Expand Up @@ -84,7 +84,6 @@
import org.neo4j.kernel.impl.spi.SimpleKernelContext;
import org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine;
import org.neo4j.kernel.impl.storageengine.impl.recordstorage.id.IdController;
import org.neo4j.kernel.impl.store.StoreId;
import org.neo4j.kernel.impl.store.format.RecordFormatPropertyConfigurator;
import org.neo4j.kernel.impl.store.format.RecordFormatSelector;
import org.neo4j.kernel.impl.store.format.RecordFormats;
Expand Down Expand Up @@ -152,6 +151,7 @@
import org.neo4j.scheduler.JobScheduler;
import org.neo4j.storageengine.api.StorageEngine;
import org.neo4j.storageengine.api.StoreFileMetadata;
import org.neo4j.storageengine.api.StoreId;
import org.neo4j.time.SystemNanoClock;
import org.neo4j.util.VisibleForTesting;

Expand Down
Expand Up @@ -106,12 +106,12 @@
import org.neo4j.kernel.impl.query.TransactionalContext;
import org.neo4j.kernel.impl.query.TransactionalContextFactory;
import org.neo4j.kernel.impl.query.clientconnection.ClientConnectionInfo;
import org.neo4j.kernel.impl.store.StoreId;
import org.neo4j.kernel.impl.traversal.BidirectionalTraversalDescriptionImpl;
import org.neo4j.kernel.impl.traversal.MonoDirectionalTraversalDescription;
import org.neo4j.kernel.impl.util.ValueUtils;
import org.neo4j.kernel.internal.GraphDatabaseAPI;
import org.neo4j.storageengine.api.EntityType;
import org.neo4j.storageengine.api.StoreId;
import org.neo4j.values.storable.Values;
import org.neo4j.values.virtual.MapValue;

Expand Down
Expand Up @@ -77,7 +77,6 @@
import org.neo4j.kernel.impl.store.RecordStore;
import org.neo4j.kernel.impl.store.SchemaStorage;
import org.neo4j.kernel.impl.store.StoreFactory;
import org.neo4j.kernel.impl.store.StoreId;
import org.neo4j.kernel.impl.store.StoreType;
import org.neo4j.kernel.impl.store.format.RecordFormat;
import org.neo4j.kernel.impl.store.id.IdGeneratorFactory;
Expand Down Expand Up @@ -105,6 +104,7 @@
import org.neo4j.storageengine.api.StorageEngine;
import org.neo4j.storageengine.api.StorageReader;
import org.neo4j.storageengine.api.StoreFileMetadata;
import org.neo4j.storageengine.api.StoreId;
import org.neo4j.storageengine.api.TransactionApplicationMode;
import org.neo4j.storageengine.api.lock.ResourceLocker;
import org.neo4j.storageengine.api.schema.SchemaRule;
Expand Down
Expand Up @@ -47,6 +47,7 @@
import org.neo4j.kernel.impl.util.OutOfOrderSequence;
import org.neo4j.logging.LogProvider;
import org.neo4j.logging.Logger;
import org.neo4j.storageengine.api.StoreId;
import org.neo4j.time.Clocks;

import static java.lang.String.format;
Expand Down
Expand Up @@ -19,6 +19,8 @@
*/
package org.neo4j.kernel.impl.store;

import org.neo4j.storageengine.api.StoreId;

public class MismatchingStoreIdException extends StoreFailureException
{
private final StoreId expected;
Expand Down
Expand Up @@ -29,7 +29,7 @@
import org.neo4j.internal.kernel.api.security.LoginContext;
import org.neo4j.kernel.api.KernelTransaction;
import org.neo4j.kernel.impl.coreapi.InternalTransaction;
import org.neo4j.kernel.impl.store.StoreId;
import org.neo4j.storageengine.api.StoreId;

/**
* This API can be used to get access to services.
Expand Down
Expand Up @@ -31,9 +31,9 @@
import org.neo4j.internal.diagnostics.DiagnosticsProvider;
import org.neo4j.helpers.Format;
import org.neo4j.kernel.impl.factory.DatabaseInfo;
import org.neo4j.kernel.impl.store.StoreId;
import org.neo4j.kernel.impl.store.StoreType;
import org.neo4j.logging.Logger;
import org.neo4j.storageengine.api.StoreId;

public abstract class KernelDiagnostics implements DiagnosticsProvider
{
Expand Down
Expand Up @@ -39,9 +39,9 @@
import org.neo4j.kernel.impl.factory.GraphDatabaseFacade;
import org.neo4j.kernel.impl.query.QueryExecutionKernelException;
import org.neo4j.kernel.impl.query.TransactionalContext;
import org.neo4j.kernel.impl.store.StoreId;
import org.neo4j.kernel.lifecycle.LifecycleException;
import org.neo4j.logging.Logger;
import org.neo4j.storageengine.api.StoreId;
import org.neo4j.values.virtual.MapValue;

/**
Expand Down
Expand Up @@ -41,7 +41,7 @@
import org.neo4j.kernel.impl.factory.GraphDatabaseFacade;
import org.neo4j.kernel.impl.query.QueryExecutionKernelException;
import org.neo4j.kernel.impl.query.TransactionalContext;
import org.neo4j.kernel.impl.store.StoreId;
import org.neo4j.storageengine.api.StoreId;
import org.neo4j.values.virtual.MapValue;

public class ProcedureGDBFacadeSPI implements GraphDatabaseFacade.SPI
Expand Down
Expand Up @@ -28,7 +28,7 @@
import org.neo4j.kernel.impl.core.TokenHolders;
import org.neo4j.kernel.impl.factory.GraphDatabaseFacade;
import org.neo4j.kernel.impl.proc.Procedures;
import org.neo4j.kernel.impl.store.StoreId;
import org.neo4j.storageengine.api.StoreId;

public class DataSourceModule
{
Expand Down
Expand Up @@ -63,8 +63,8 @@
import org.neo4j.internal.kernel.api.security.LoginContext;
import org.neo4j.kernel.api.KernelTransaction;
import org.neo4j.kernel.impl.coreapi.InternalTransaction;
import org.neo4j.kernel.impl.store.StoreId;
import org.neo4j.kernel.internal.GraphDatabaseAPI;
import org.neo4j.storageengine.api.StoreId;

public class ReadOnlyGraphDatabaseProxy implements GraphDatabaseService, GraphDatabaseAPI, IndexManager
{
Expand Down
Expand Up @@ -39,7 +39,6 @@
import org.neo4j.kernel.configuration.Config;
import org.neo4j.kernel.impl.factory.Edition;
import org.neo4j.kernel.impl.factory.OperationalMode;
import org.neo4j.kernel.impl.store.StoreId;
import org.neo4j.kernel.impl.store.format.RecordFormat;
import org.neo4j.kernel.impl.store.id.IdGenerator;
import org.neo4j.kernel.impl.store.id.IdGeneratorFactory;
Expand All @@ -49,6 +48,7 @@
import org.neo4j.kernel.impl.util.Dependencies;
import org.neo4j.scheduler.JobScheduler;
import org.neo4j.storageengine.api.StoreFileMetadata;
import org.neo4j.storageengine.api.StoreId;
import org.neo4j.test.rule.TestDirectory;
import org.neo4j.udc.UsageData;
import org.neo4j.udc.UsageDataKeys;
Expand Down
Expand Up @@ -41,7 +41,6 @@
import org.neo4j.kernel.NeoStoreDataSource;
import org.neo4j.kernel.configuration.Config;
import org.neo4j.kernel.impl.enterprise.configuration.OnlineBackupSettings;
import org.neo4j.kernel.impl.store.StoreId;
import org.neo4j.kernel.impl.transaction.log.LogFileInformation;
import org.neo4j.kernel.impl.transaction.log.LogicalTransactionStore;
import org.neo4j.kernel.impl.transaction.log.TransactionIdStore;
Expand All @@ -52,6 +51,7 @@
import org.neo4j.kernel.monitoring.ByteCounterMonitor;
import org.neo4j.kernel.monitoring.Monitors;
import org.neo4j.logging.LogProvider;
import org.neo4j.storageengine.api.StoreId;

import static org.neo4j.kernel.impl.enterprise.configuration.OnlineBackupSettings.online_backup_server;

Expand Down
Expand Up @@ -37,12 +37,12 @@
import org.neo4j.com.storecopy.ResponseUnpacker;
import org.neo4j.com.storecopy.StoreWriter;
import org.neo4j.com.storecopy.ToNetworkStoreWriter;
import org.neo4j.kernel.impl.store.StoreId;
import org.neo4j.kernel.impl.transaction.log.ReadableClosablePositionAwareChannel;
import org.neo4j.kernel.impl.transaction.log.entry.LogEntryReader;
import org.neo4j.kernel.monitoring.ByteCounterMonitor;
import org.neo4j.kernel.monitoring.Monitors;
import org.neo4j.logging.LogProvider;
import org.neo4j.storageengine.api.StoreId;

import static org.neo4j.backup.impl.BackupServer.BACKUP_PROTOCOL_VERSION;
import static org.neo4j.backup.impl.BackupServer.FRAME_LENGTH;
Expand Down
Expand Up @@ -30,12 +30,12 @@
import org.neo4j.com.storecopy.ResponsePacker;
import org.neo4j.com.storecopy.StoreCopyServer;
import org.neo4j.com.storecopy.StoreWriter;
import org.neo4j.kernel.impl.store.StoreId;
import org.neo4j.kernel.impl.transaction.log.LogFileInformation;
import org.neo4j.kernel.impl.transaction.log.LogicalTransactionStore;
import org.neo4j.kernel.impl.transaction.log.TransactionIdStore;
import org.neo4j.logging.LogProvider;
import org.neo4j.logging.Logger;
import org.neo4j.storageengine.api.StoreId;

import static org.neo4j.com.RequestContext.anonymous;

Expand Down
Expand Up @@ -65,7 +65,6 @@
import org.neo4j.kernel.impl.logging.LogService;
import org.neo4j.kernel.impl.store.MetaDataStore;
import org.neo4j.kernel.impl.store.MismatchingStoreIdException;
import org.neo4j.kernel.impl.store.StoreId;
import org.neo4j.kernel.impl.store.UnexpectedStoreVersionException;
import org.neo4j.kernel.impl.store.id.IdGeneratorImpl;
import org.neo4j.kernel.impl.storemigration.UpgradeNotAllowedByConfigurationException;
Expand All @@ -81,6 +80,7 @@
import org.neo4j.logging.Log;
import org.neo4j.logging.LogProvider;
import org.neo4j.logging.NullLogProvider;
import org.neo4j.storageengine.api.StoreId;

import static org.neo4j.com.RequestContext.anonymous;
import static org.neo4j.com.storecopy.TransactionCommittingResponseUnpacker.DEFAULT_BATCH_SIZE;
Expand Down
Expand Up @@ -33,12 +33,12 @@
import org.neo4j.com.storecopy.StoreCopyServer;
import org.neo4j.com.storecopy.StoreCopyServer.Monitor;
import org.neo4j.helpers.collection.Visitor;
import org.neo4j.kernel.impl.store.StoreId;
import org.neo4j.kernel.impl.transaction.CommittedTransactionRepresentation;
import org.neo4j.kernel.impl.transaction.log.LogFileInformation;
import org.neo4j.kernel.impl.transaction.log.LogicalTransactionStore;
import org.neo4j.kernel.impl.transaction.log.NoSuchTransactionException;
import org.neo4j.kernel.impl.transaction.log.TransactionIdStore;
import org.neo4j.storageengine.api.StoreId;

import static org.neo4j.kernel.impl.transaction.log.TransactionIdStore.BASE_TX_ID;

Expand Down
Expand Up @@ -29,11 +29,11 @@
import org.neo4j.com.RequestContext;
import org.neo4j.com.storecopy.StoreCopyServer;
import org.neo4j.com.storecopy.StoreWriter;
import org.neo4j.kernel.impl.store.StoreId;
import org.neo4j.kernel.impl.transaction.log.LogFileInformation;
import org.neo4j.kernel.impl.transaction.log.LogicalTransactionStore;
import org.neo4j.kernel.impl.transaction.log.TransactionIdStore;
import org.neo4j.logging.NullLogProvider;
import org.neo4j.storageengine.api.StoreId;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
Expand Down
Expand Up @@ -33,14 +33,14 @@
import org.neo4j.com.storecopy.ResponseUnpacker;
import org.neo4j.com.storecopy.StoreWriter;
import org.neo4j.helpers.HostnamePort;
import org.neo4j.kernel.impl.store.StoreId;
import org.neo4j.kernel.impl.transaction.log.ReadableClosablePositionAwareChannel;
import org.neo4j.kernel.impl.transaction.log.entry.LogEntryReader;
import org.neo4j.kernel.impl.transaction.log.entry.VersionAwareLogEntryReader;
import org.neo4j.kernel.lifecycle.LifeSupport;
import org.neo4j.kernel.monitoring.ByteCounterMonitor;
import org.neo4j.logging.NullLogProvider;
import org.neo4j.ports.allocation.PortAuthority;
import org.neo4j.storageengine.api.StoreId;

import static org.jboss.netty.buffer.ChannelBuffers.EMPTY_BUFFER;
import static org.junit.Assert.assertEquals;
Expand Down
Expand Up @@ -153,7 +153,7 @@ public boolean isEmpty( File storeDir, List<File> filesToLookFor ) throws IOExce
public StoreId readStoreId( File storeDir ) throws IOException
{
File neoStoreFile = new File( storeDir, MetaDataStore.DEFAULT_NAME );
org.neo4j.kernel.impl.store.StoreId kernelStoreId = MetaDataStore.getStoreId( pageCache, neoStoreFile );
org.neo4j.storageengine.api.StoreId kernelStoreId = MetaDataStore.getStoreId( pageCache, neoStoreFile );
return new StoreId( kernelStoreId.getCreationTime(), kernelStoreId.getRandomId(),
kernelStoreId.getUpgradeTime(), kernelStoreId.getUpgradeId() );
}
Expand Down
Expand Up @@ -22,17 +22,17 @@
*/
package org.neo4j.causalclustering.identity;

import static java.lang.String.format;

import java.util.Objects;

import static java.lang.String.format;

public final class StoreId
{
public static final StoreId DEFAULT = new StoreId(
org.neo4j.kernel.impl.store.StoreId.DEFAULT.getCreationTime(),
org.neo4j.kernel.impl.store.StoreId.DEFAULT.getRandomId(),
org.neo4j.kernel.impl.store.StoreId.DEFAULT.getUpgradeTime(),
org.neo4j.kernel.impl.store.StoreId.DEFAULT.getUpgradeId() );
org.neo4j.storageengine.api.StoreId.DEFAULT.getCreationTime(),
org.neo4j.storageengine.api.StoreId.DEFAULT.getRandomId(),
org.neo4j.storageengine.api.StoreId.DEFAULT.getUpgradeTime(),
org.neo4j.storageengine.api.StoreId.DEFAULT.getUpgradeId() );

public static boolean isDefault( StoreId storeId )
{
Expand Down Expand Up @@ -75,7 +75,7 @@ public long getUpgradeId()
return upgradeId;
}

public boolean equalToKernelStoreId( org.neo4j.kernel.impl.store.StoreId kernelStoreId )
public boolean equalToKernelStoreId( org.neo4j.storageengine.api.StoreId kernelStoreId )
{
return creationTime == kernelStoreId.getCreationTime() &&
randomId == kernelStoreId.getRandomId() &&
Expand Down
Expand Up @@ -148,7 +148,7 @@ private PrepareStoreCopyRequestHandler createHandler()
catchupServerProtocol = new CatchupServerProtocol();
catchupServerProtocol.expect( CatchupServerProtocol.State.PREPARE_STORE_COPY );
Supplier<NeoStoreDataSource> dataSourceSupplier = () -> neoStoreDataSource;
when( neoStoreDataSource.getStoreId() ).thenReturn( new org.neo4j.kernel.impl.store.StoreId( 1, 2, 5, 3, 4 ) );
when( neoStoreDataSource.getStoreId() ).thenReturn( new org.neo4j.storageengine.api.StoreId( 1, 2, 5, 3, 4 ) );

PrepareStoreCopyFilesProvider prepareStoreCopyFilesProvider = mock( PrepareStoreCopyFilesProvider.class );
when( prepareStoreCopyFilesProvider.prepareStoreCopyFiles( any() ) ).thenReturn( prepareStoreCopyFiles );
Expand Down
Expand Up @@ -98,7 +98,7 @@ StoreCopyFinishedResponse requestIndividualFile( File file, StoreId expectedStor

private StoreId getStoreIdFromKernelStoreId( GraphDatabaseAPI graphDb )
{
org.neo4j.kernel.impl.store.StoreId storeId = graphDb.storeId();
org.neo4j.storageengine.api.StoreId storeId = graphDb.storeId();
return new StoreId( storeId.getCreationTime(), storeId.getRandomId(), storeId.getUpgradeTime(), storeId.getUpgradeId() );
}

Expand Down
Expand Up @@ -85,7 +85,7 @@ public void setup()
new NiceStoreCopyRequestHandler( catchupServerProtocol, () -> neoStoreDataSource, new StoreFileStreamingProtocol(),
fileSystemAbstraction, NullLogProvider.getInstance() );
Dependencies dependencies = new Dependencies();
when( neoStoreDataSource.getStoreId() ).thenReturn( new org.neo4j.kernel.impl.store.StoreId( 1, 2, 5, 3, 4 ) );
when( neoStoreDataSource.getStoreId() ).thenReturn( new org.neo4j.storageengine.api.StoreId( 1, 2, 5, 3, 4 ) );
when( neoStoreDataSource.getDependencyResolver() ).thenReturn( dependencies );
embeddedChannel = new EmbeddedChannel( storeCopyRequestHandler );
}
Expand Down
Expand Up @@ -84,7 +84,7 @@ private static ChildInitializer childInitializer( FileSystemAbstraction fileSyst
Supplier<NeoStoreDataSource> dataSource = () -> graphDb.getDependencyResolver().resolveDependency( NeoStoreDataSource.class );
LogProvider logProvider = NullLogProvider.getInstance();

org.neo4j.kernel.impl.store.StoreId kernelStoreId = dataSource.get().getStoreId();
org.neo4j.storageengine.api.StoreId kernelStoreId = dataSource.get().getStoreId();
StoreId storeId = new StoreId( kernelStoreId.getCreationTime(), kernelStoreId.getRandomId(), kernelStoreId.getUpgradeTime(),
kernelStoreId.getUpgradeId() );

Expand Down

0 comments on commit ad3f86a

Please sign in to comment.