/** {@inheritDoc} */ @Override public String name() { return igfsEx.name(); }
/** * @param req Path control request. * @return Affinity key that maps on local node by the time this method is called if replication factor * is {@code 0}, {@code null} otherwise. */ @Nullable private IgniteUuid affinityKey(IgfsPathControlRequest req) { // Do not generate affinity key for replicated or near-only cache. if (!req.colocate()) { if (log.isDebugEnabled()) log.debug("Will not generate affinity key for path control request [igfsName=" + igfs.name() + ", req=" + req + ']'); return null; } IgniteUuid key = igfs.nextAffinityKey(); if (log.isDebugEnabled()) log.debug("Generated affinity key for path control request [igfsName=" + igfs.name() + ", req=" + req + ", key=" + key + ']'); return key; }
@Override public IgfsHandshakeResponse apply() { igfs.clientLogDirectory(logDir); return new IgfsHandshakeResponse(igfs.name(), igfs.groupBlockSize(), igfs.globalSampling()); } });
/** * Processes handshake request. * * @param req Handshake request. * @return Response message. * @throws IgniteCheckedException In case of handshake failure. */ private IgfsMessage processHandshakeRequest(IgfsHandshakeRequest req) throws IgniteCheckedException { if (req.igfsName() != null && !F.eq(igfs.name(), req.igfsName())) throw new IgniteCheckedException("Failed to perform handshake because existing IGFS name " + "differs from requested [requested=" + req.igfsName() + ", existing=" + igfs.name() + ']'); IgfsControlResponse res = new IgfsControlResponse(); igfs.clientLogDirectory(req.logDirectory()); IgfsHandshakeResponse handshake = new IgfsHandshakeResponse(igfs.name(), igfs.groupBlockSize(), igfs.globalSampling()); res.handshake(handshake); return res; }
/** * Constructs IGFS IPC handler. * * @param igfsCtx Context. * @param endpointCfg Endpoint configuration. * @param mgmt Management flag. */ IgfsIpcHandler(IgfsContext igfsCtx, IgfsIpcEndpointConfiguration endpointCfg, boolean mgmt) { assert igfsCtx != null; ctx = igfsCtx.kernalContext(); igfs = igfsCtx.igfs(); // Keep buffer size multiple of block size so no extra byte array copies is performed. bufSize = igfsCtx.configuration().getBlockSize() * 2; // Create thread pool for request handling. int threadCnt = endpointCfg.getThreadCount(); String prefix = "igfs-" + igfsCtx.igfs().name() + (mgmt ? "mgmt-" : "") + "-ipc"; pool = new IgniteThreadPoolExecutor(prefix, igfsCtx.kernalContext().igniteInstanceName(), threadCnt, threadCnt, Long.MAX_VALUE, new LinkedBlockingQueue<Runnable>()); log = ctx.log(IgfsIpcHandler.class); }
/** * Constructor. * * @param igfsCtx IGFS context. */ IgfsDeleteWorker(IgfsContext igfsCtx) { super("igfs-delete-worker%" + igfsCtx.igfs().name() + "%" + igfsCtx.kernalContext().localNodeId() + "%"); this.igfsCtx = igfsCtx; meta = igfsCtx.meta(); data = igfsCtx.data(); assert meta != null; assert data != null; log = igfsCtx.kernalContext().log(IgfsDeleteWorker.class); }
log.debug("Requested to close resource [igfsName=" + igfs.name() + ", rsrcId=" + rsrcId + ", res=" + res + ']'); assert success : "Failed to unregister resource [igfsName=" + igfs.name() + ", rsrcId=" + rsrcId + ", res=" + res + ']'; log.debug("Closed IGFS stream [igfsName=" + igfs.name() + ", streamId=" + rsrcId + ", ses=" + ses + ']');
/** * Ensure that the given paths don't exist in the given IGFS. * * @param uni secondary FS. * @param paths Paths. * @throws Exception If failed. */ protected void checkNotExist(IgfsSecondaryFileSystemTestAdapter uni, IgfsPath... paths) throws Exception { IgfsEx ex = uni.igfs(); for (IgfsPath path : paths) { if (ex != null) assert !ex.exists(path) : "Path exists [igfs=" + ex.name() + ", path=" + path + ']'; assert !uni.exists(path.toString()) : "Path exists [igfs=" + uni.name() + ", path=" + path + ']'; } }
/** * Ensure that the given paths exist in the given IGFS. * * @param uni filesystem. * @param paths Paths. * @throws IgniteCheckedException If failed. */ protected void checkExist(IgfsSecondaryFileSystemTestAdapter uni, IgfsPath... paths) throws IgniteCheckedException { IgfsEx ex = uni.igfs(); for (IgfsPath path : paths) { if (ex != null) assert ex.context().meta().fileId(path) != null : "Path doesn't exist [igfs=" + ex.name() + ", path=" + path + ']'; try { assert uni.exists(path.toString()) : "Path doesn't exist [igfs=" + uni.name() + ", path=" + path + ']'; } catch (IOException ioe) { throw new IgniteCheckedException(ioe); } } }
log.debug("Opened IGFS input stream for file read [igfsName=" + igfs.name() + ", path=" + req.path() + ", streamId=" + streamId + ", ses=" + ses + ']'); log.debug("Opened IGFS output stream for file create [igfsName=" + igfs.name() + ", path=" + req.path() + ", streamId=" + streamId + ", ses=" + ses + ']'); log.debug("Opened IGFS output stream for file append [igfsName=" + igfs.name() + ", path=" + req.path() + ", streamId=" + streamId + ", ses=" + ses + ']');
/** * @param req Path control request. * @return Affinity key that maps on local node by the time this method is called if replication factor * is {@code 0}, {@code null} otherwise. */ @Nullable private IgniteUuid affinityKey(IgfsPathControlRequest req) { // Do not generate affinity key for replicated or near-only cache. if (!req.colocate()) { if (log.isDebugEnabled()) log.debug("Will not generate affinity key for path control request [igfsName=" + igfs.name() + ", req=" + req + ']'); return null; } IgniteUuid key = igfs.nextAffinityKey(); if (log.isDebugEnabled()) log.debug("Generated affinity key for path control request [igfsName=" + igfs.name() + ", req=" + req + ", key=" + key + ']'); return key; }
/** * Processes handshake request. * * @param req Handshake request. * @return Response message. * @throws IgniteCheckedException In case of handshake failure. */ private IgfsMessage processHandshakeRequest(IgfsHandshakeRequest req) throws IgniteCheckedException { if (req.igfsName() != null && !F.eq(igfs.name(), req.igfsName())) throw new IgniteCheckedException("Failed to perform handshake because existing IGFS name " + "differs from requested [requested=" + req.igfsName() + ", existing=" + igfs.name() + ']'); IgfsControlResponse res = new IgfsControlResponse(); igfs.clientLogDirectory(req.logDirectory()); IgfsHandshakeResponse handshake = new IgfsHandshakeResponse(igfs.name(), igfs.groupBlockSize(), igfs.globalSampling()); res.handshake(handshake); return res; }
/** * Constructs IGFS IPC handler. * * @param igfsCtx Context. * @param endpointCfg Endpoint configuration. * @param mgmt Management flag. */ IgfsIpcHandler(IgfsContext igfsCtx, IgfsIpcEndpointConfiguration endpointCfg, boolean mgmt) { assert igfsCtx != null; ctx = igfsCtx.kernalContext(); igfs = igfsCtx.igfs(); // Keep buffer size multiple of block size so no extra byte array copies is performed. bufSize = igfsCtx.configuration().getBlockSize() * 2; // Create thread pool for request handling. int threadCnt = endpointCfg.getThreadCount(); String prefix = "igfs-" + igfsCtx.igfs().name() + (mgmt ? "mgmt-" : "") + "-ipc"; pool = new IgniteThreadPoolExecutor(prefix, igfsCtx.kernalContext().igniteInstanceName(), threadCnt, threadCnt, Long.MAX_VALUE, new LinkedBlockingQueue<Runnable>()); log = ctx.log(IgfsIpcHandler.class); }
/** * Constructor. * * @param igfsCtx IGFS context. */ IgfsDeleteWorker(IgfsContext igfsCtx) { super("igfs-delete-worker%" + igfsCtx.igfs().name() + "%" + igfsCtx.kernalContext().localNodeId() + "%"); this.igfsCtx = igfsCtx; meta = igfsCtx.meta(); data = igfsCtx.data(); assert meta != null; assert data != null; log = igfsCtx.kernalContext().log(IgfsDeleteWorker.class); }
log.debug("Requested to close resource [igfsName=" + igfs.name() + ", rsrcId=" + rsrcId + ", res=" + res + ']'); assert success : "Failed to unregister resource [igfsName=" + igfs.name() + ", rsrcId=" + rsrcId + ", res=" + res + ']'; log.debug("Closed IGFS stream [igfsName=" + igfs.name() + ", streamId=" + rsrcId + ", ses=" + ses + ']');
log.debug("Opened IGFS input stream for file read [igfsName=" + igfs.name() + ", path=" + req.path() + ", streamId=" + streamId + ", ses=" + ses + ']'); log.debug("Opened IGFS output stream for file create [igfsName=" + igfs.name() + ", path=" + req.path() + ", streamId=" + streamId + ", ses=" + ses + ']'); log.debug("Opened IGFS output stream for file append [igfsName=" + igfs.name() + ", path=" + req.path() + ", streamId=" + streamId + ", ses=" + ses + ']');