Skip to content

Commit

Permalink
pool: don't pass checksum module to transfer services
Browse files Browse the repository at this point in the history
Motivation:
as mover doesn't talk with checksum module directly (it happens through
ChecksumChannel) we don't need to pass an instance of checksum module to
all transfer services.

Modification:
remove references to ChecksumModule in transfer services, mover
factories and mover implementations.

Result:
less dead code.

Acked-by: Paul Millar
Target: master
Require-book: no
Require-notes: no
  • Loading branch information
kofemann committed Jul 16, 2019
1 parent 3959ad0 commit c7cf6c0
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 55 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* dCache - http://www.dcache.org/
*
* Copyright (C) 2013 - 2017 Deutsches Elektronen-Synchrotron
* Copyright (C) 2013 - 2019 Deutsches Elektronen-Synchrotron
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -38,7 +38,6 @@
import org.dcache.nfs.v4.xdr.stateid4;
import org.dcache.nfs.status.NfsIoException;
import org.dcache.pool.classic.Cancellable;
import org.dcache.pool.classic.ChecksumModule;
import org.dcache.pool.movers.MoverChannelMover;
import org.dcache.pool.repository.ReplicaDescriptor;
import org.dcache.vehicles.FileAttributes;
Expand All @@ -53,8 +52,8 @@ public class NfsMover extends MoverChannelMover<NFS4ProtocolInfo, NfsMover> {
private volatile CompletionHandler<Void, Void> _completionHandler;

public NfsMover(ReplicaDescriptor handle, PoolIoFileMessage message, CellPath pathToDoor,
NfsTransferService nfsTransferService, PnfsHandler pnfsHandler, ChecksumModule checksumModule) {
super(handle, message, pathToDoor, nfsTransferService, checksumModule);
NfsTransferService nfsTransferService, PnfsHandler pnfsHandler) {
super(handle, message, pathToDoor, nfsTransferService);
_nfsIO = nfsTransferService.getNfsMoverHandler();
org.dcache.chimera.nfs.v4.xdr.stateid4 legacyStateid = getProtocolInfo().stateId();
_state = new MoverState(null, new stateid4(legacyStateid.other, legacyStateid.seqid.value));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ public class NfsTransferService
private final long _bootVerifier = System.currentTimeMillis();
private boolean _sortMultipathList;
private PnfsHandler _pnfsHandler;
private ChecksumModule _checksumModule;
private int _minTcpPort;
private int _maxTcpPort;
private IoStrategy _ioStrategy;
Expand Down Expand Up @@ -174,11 +173,6 @@ public void setDoorStub(CellStub cellStub) {
_door = cellStub;
}

@Required
public void setChecksumModule(ChecksumModule checksumModule) {
_checksumModule = checksumModule;
}

@Required
public void setMinTcpPort(int minPort) {
_minTcpPort = minPort;
Expand Down Expand Up @@ -210,7 +204,7 @@ public void shutdown() throws IOException {
@Override
public Mover<?> createMover(ReplicaDescriptor handle, PoolIoFileMessage message, CellPath pathToDoor) throws CacheException
{
return new NfsMover(handle, message, pathToDoor, this, _pnfsHandler, _checksumModule);
return new NfsMover(handle, message, pathToDoor, this, _pnfsHandler);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* dCache - http://www.dcache.org/
*
* Copyright (C) 2015 - 2017 Deutsches Elektronen-Synchrotron
* Copyright (C) 2015 - 2019 Deutsches Elektronen-Synchrotron
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -58,14 +58,8 @@ public abstract class AbstractMoverProtocolTransferService
new CDCExecutorServiceDecorator<>(
Executors.newCachedThreadPool(
new ThreadFactoryBuilder().setNameFormat(getClass().getSimpleName() + "-transfer-service-%d").build()));
private ChecksumModule _checksumModule;
private PostTransferService _postTransferService;

@Required
public void setChecksumModule(ChecksumModule checksumModule)
{
_checksumModule = checksumModule;
}

@Required
public void setPostTransferService(PostTransferService postTransferService)
Expand All @@ -80,7 +74,7 @@ public Mover<?> createMover(ReplicaDescriptor handle, PoolIoFileMessage message,
ProtocolInfo info = message.getProtocolInfo();
try {
MoverProtocol moverProtocol = createMoverProtocol(info);
return new MoverProtocolMover(handle, message, pathToDoor, this, moverProtocol, _checksumModule);
return new MoverProtocolMover(handle, message, pathToDoor, this, moverProtocol);
} catch (InvocationTargetException e) {
Throwable cause = e.getTargetException();
String causeError = cause instanceof Exception
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* dCache - http://www.dcache.org/
*
* Copyright (C) 2013 - 2017 Deutsches Elektronen-Synchrotron
* Copyright (C) 2013 - 2019 Deutsches Elektronen-Synchrotron
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -45,7 +45,6 @@
import dmg.cells.nucleus.CellPath;

import org.dcache.pool.classic.Cancellable;
import org.dcache.pool.classic.ChecksumModule;
import org.dcache.pool.classic.TransferService;
import org.dcache.pool.repository.FileStore;
import org.dcache.pool.repository.OutOfDiskException;
Expand Down Expand Up @@ -87,8 +86,7 @@ public abstract class AbstractMover<P extends ProtocolInfo, M extends AbstractMo
private volatile Optional<RepositoryChannel> _channel = Optional.empty();

public AbstractMover(ReplicaDescriptor handle, PoolIoFileMessage message, CellPath pathToDoor,
TransferService<M> transferService,
ChecksumModule checksumModule)
TransferService<M> transferService)
{
TypeToken<M> type = new TypeToken<M>(getClass()) {};
checkArgument(type.isSupertypeOf(getClass()));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* dCache - http://www.dcache.org/
*
* Copyright (C) 2013 - 2017 Deutsches Elektronen-Synchrotron
* Copyright (C) 2013 - 2019 Deutsches Elektronen-Synchrotron
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand All @@ -26,7 +26,6 @@

import dmg.cells.nucleus.CellPath;

import org.dcache.pool.classic.ChecksumModule;
import org.dcache.pool.classic.TransferService;
import org.dcache.pool.repository.ReplicaDescriptor;

Expand All @@ -43,10 +42,9 @@ public abstract class MoverChannelMover<P extends ProtocolInfo, M extends MoverC

public MoverChannelMover(ReplicaDescriptor handle, PoolIoFileMessage message,
CellPath pathToDoor,
TransferService<M> transferService,
ChecksumModule checksumModule)
TransferService<M> transferService)
{
super(handle, message, pathToDoor, transferService, checksumModule);
super(handle, message, pathToDoor, transferService);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* dCache - http://www.dcache.org/
*
* Copyright (C) 2013 Deutsches Elektronen-Synchrotron
* Copyright (C) 2013 - 2019 Deutsches Elektronen-Synchrotron
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand All @@ -24,7 +24,6 @@

import org.dcache.pool.classic.TransferService;
import org.dcache.pool.repository.ReplicaDescriptor;
import org.dcache.pool.classic.ChecksumModule;

/**
* A Mover implementation based on the MoverProtocol interface.
Expand All @@ -38,9 +37,9 @@ public class MoverProtocolMover extends AbstractMover<ProtocolInfo, MoverProtoco

public MoverProtocolMover(ReplicaDescriptor handle, PoolIoFileMessage message, CellPath pathToDoor,
TransferService<MoverProtocolMover> transferService,
MoverProtocol moverProtocol, ChecksumModule checksumModule)
MoverProtocol moverProtocol)
{
super(handle, message, pathToDoor, transferService, checksumModule);
super(handle, message, pathToDoor, transferService);
_moverProtocol = moverProtocol;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* dCache - http://www.dcache.org/
*
* Copyright (C) 2013-2017 Deutsches Elektronen-Synchrotron
* Copyright (C) 2013-2019 Deutsches Elektronen-Synchrotron
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand All @@ -24,7 +24,6 @@

import dmg.cells.nucleus.CellPath;

import org.dcache.pool.classic.ChecksumModule;
import org.dcache.pool.classic.TransferService;
import org.dcache.pool.repository.ReplicaDescriptor;

Expand All @@ -40,10 +39,9 @@ public NettyMover(ReplicaDescriptor handle,
PoolIoFileMessage message,
CellPath pathToDoor,
TransferService<NettyMover<P>> transferService,
UUID uuid,
ChecksumModule checksumModule)
UUID uuid)
{
super(handle, message, pathToDoor, transferService, checksumModule);
super(handle, message, pathToDoor, transferService);
this.uuid = uuid;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* dCache - http://www.dcache.org/
*
* Copyright (C) 2013-2015 Deutsches Elektronen-Synchrotron
* Copyright (C) 2013 - 2019 Deutsches Elektronen-Synchrotron
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -64,7 +64,6 @@

import org.dcache.cells.CellStub;
import org.dcache.pool.classic.Cancellable;
import org.dcache.pool.classic.ChecksumModule;
import org.dcache.pool.classic.PostTransferService;
import org.dcache.pool.classic.TransferService;
import org.dcache.pool.repository.ReplicaDescriptor;
Expand Down Expand Up @@ -125,9 +124,6 @@ public abstract class NettyTransferService<P extends ProtocolInfo>
/** Service to post process movers. */
private PostTransferService postTransferService;

/** Service to calculate and verify checksums. */
protected ChecksumModule checksumModule;

/** Timeout for when to disconnect an idle client. */
protected long clientIdleTimeout;
protected TimeUnit clientIdleTimeoutUnit;
Expand All @@ -146,12 +142,6 @@ public NettyTransferService(String name)
this.name = name;
}

@Required
public void setChecksumModule(ChecksumModule checksumModule)
{
this.checksumModule = checksumModule;
}

@Required
public void setThreads(int threads)
{
Expand Down Expand Up @@ -356,7 +346,7 @@ public Mover<?> createMover(ReplicaDescriptor handle, PoolIoFileMessage message,
CellPath pathToDoor) throws CacheException
{
return new NettyMover<>(handle, message, pathToDoor, this,
createUuid((P) message.getProtocolInfo()), checksumModule);
createUuid((P) message.getProtocolInfo()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@
<bean id="default-transfer-service" class="org.dcache.pool.classic.MoverMapTransferService"
destroy-method="shutdown" depends-on="rep">
<description>Generic transfer service</description>
<property name="checksumModule" ref="csm"/>
<property name="postTransferService" ref="post-transfer-service"/>
</bean>

Expand All @@ -341,7 +340,6 @@
<property name="postTransferService" ref="post-transfer-service"/>
<property name="pnfsHandler" ref="pnfs"/>
<property name="doorStub" ref="doorStub"/>
<property name="checksumModule" ref="csm"/>
<property name="minTcpPort" value="${pool.mover.nfs.port.min}"/>
<property name="maxTcpPort" value="${pool.mover.nfs.port.max}"/>
<property name="tcpPortFile" value="${pool.path}/mover-tcp-port.nfs"/>
Expand All @@ -359,7 +357,6 @@
depends-on="rep">
<description>Xrootd transfer service</description>
<property name="postTransferService" ref="post-transfer-service"/>
<property name="checksumModule" ref="csm"/>
<property name="threads" value="${pool.mover.xrootd.threads}"/>
<property name="clientIdleTimeout" value="${pool.mover.xrootd.timeout.idle}"/>
<property name="clientIdleTimeoutUnit" value="${pool.mover.xrootd.timeout.idle.unit}"/>
Expand Down Expand Up @@ -403,7 +400,6 @@
depends-on="rep">
<description>HTTP transfer service</description>
<property name="postTransferService" ref="post-transfer-service"/>
<property name="checksumModule" ref="csm"/>
<property name="threads" value="${pool.mover.http.threads}"/>
<property name="chunkSize" value="${pool.mover.http.chunk-size}"/>
<property name="clientIdleTimeout" value="${pool.mover.http.timeout.idle}"/>
Expand All @@ -424,7 +420,6 @@

<bean id="remote-http-transfer-service" class="org.dcache.pool.classic.RemoteHttpTransferService"
depends-on="rep" destroy-method="shutdown">
<property name="checksumModule" ref="csm"/>
<property name="postTransferService" ref="post-transfer-service"/>
<property name="certificateAuthorityPath" value="${pool.authn.capath}"/>
<property name="certificateAuthorityUpdateInterval" value="${pool.authn.capath.refresh}"/>
Expand All @@ -441,7 +436,6 @@

<bean id="remote-gsiftp-transfer-service" class="org.dcache.pool.classic.RemoteGsiftpTransferService"
depends-on="rep" destroy-method="shutdown">
<property name="checksumModule" ref="csm"/>
<property name="postTransferService" ref="post-transfer-service"/>
<property name="certificateAuthorityPath" value="${pool.authn.capath}"/>
<property name="certificateAuthorityUpdateInterval" value="${pool.authn.capath.refresh}"/>
Expand Down

0 comments on commit c7cf6c0

Please sign in to comment.