Registers the given operation in the ReadIndex.

@param operation The operation to register.
503641
private void addToReadIndex(StorageOperation operation) {
        try {
            if (operation instanceof StreamSegmentAppendOperation) {
                // Record a StreamSegmentAppendOperation. Just in case, we also support this type of operation, but we need to
                // log a warning indicating so. This means we do not optimize memory properly, and we end up storing data
                // in two different places.
                StreamSegmentAppendOperation appendOperation = (StreamSegmentAppendOperation) operation;
                this.readIndex.append(appendOperation.getStreamSegmentId(),
                        appendOperation.getStreamSegmentOffset(),
                        appendOperation.getData());
            } else if (operation instanceof MergeSegmentOperation) {
                // Record a MergeSegmentOperation. We call beginMerge here, and the StorageWriter will call completeMerge.
                MergeSegmentOperation mergeOperation = (MergeSegmentOperation) operation;
                this.readIndex.beginMerge(mergeOperation.getStreamSegmentId(),
                        mergeOperation.getStreamSegmentOffset(),
                        mergeOperation.getSourceSegmentId());
            } else {
                assert !(operation instanceof CachedStreamSegmentAppendOperation)
                        : "attempted to add a CachedStreamSegmentAppendOperation to the ReadIndex";
            }
        } catch (ObjectClosedException | StreamSegmentNotExistsException ex) {
            // The Segment is in the process of being deleted. We usually end up in here because a concurrent delete
            // request has updated the metadata while we were executing.
            log.warn("Not adding operation '{}' to ReadIndex because it refers to a deleted StreamSegment.", operation);
        }
    }
1072504
public static ZoneOperationId of(String zone, String operation) {
    return new ZoneOperationId(null, zone, operation);
  }
665319
public void register(InternalIndex index) {
        String[] components = index.getComponents();
        String attribute = components == null ? index.getName() : components[0];

        Record record = registry.get(attribute);
        if (record == null) {
            record = new Record();
            registry.put(attribute, record);
        }

        if (index.isOrdered()) {
            if (record.orderedWorseThan(index)) {
                record.ordered = components == null ? index : new FirstComponentDecorator(index);
            }
        } else {
            if (record.unorderedWorseThan(index)) {
                record.unordered = index;
            }
        }
    }
835484
public PutOperation<K, V> applyOperation(K key, PutOperation<K, V> existing, Operation<K, V> operation) {
    final Result<K, V> newValue = operation.apply(existing);
    if (newValue == null) {
      return null;
    } else {
      return newValue.asOperationExpiringAt(Long.MAX_VALUE);
    }
  }
1344825
public static OperationResult failed(long index, long eventIndex, Throwable error) {
    return new OperationResult(index, eventIndex, error, null);
  }
4068
void acceptOperation(StreamSegmentTruncateOperation operation) {
        ensureSegmentId(operation);
        this.startOffset = operation.getStreamSegmentOffset();
        this.isChanged = true;
    }
728048
public static void registerOperations(KnowledgeComponentImplementationModel model, Map<String, KnowledgeOperation> operations, KnowledgeOperation defaultOperation) {
        OperationsModel operationsModel = model.getOperations();
        if (operationsModel != null) {
            for (OperationModel operationModel : operationsModel.getOperations()) {
                String name = Strings.trimToNull(operationModel.getName());
                if (name == null) {
                    name = DEFAULT;
                }
                KnowledgeOperationType type = operationModel.getType();
                if (type == null) {
                    type = defaultOperation.getType();
                }
                String eventId = operationModel.getEventId();
                if (eventId == null) {
                    eventId = defaultOperation.getEventId();
                }
                KnowledgeOperation operation = new KnowledgeOperation(type, eventId);
                mapExpressions(operationModel, operation);
                if (operations.containsKey(name)) {
                    throw CommonKnowledgeMessages.MESSAGES.cannotRegisterOperation(type.toString(), name);
                }
                operations.put(name, operation);
            }
        }
        if (!operations.containsKey(DEFAULT)) {
            operations.put(DEFAULT, defaultOperation);
        }
    }
67791
@Override
  public void writeImpl(ObjectStoreOperation operation) throws IOException {
    operation.execute(this.getObjectStoreClient());
    this.operationsExecuted.inc();
  }
1147969
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSString response_validator = new MPSString();
		response_validator.validate(operationType, response, "\"response\"");
		
	}
521275
@Override
	public void addOperator(String operator, FunctionDescriptor fd)
    {
        m_operatorMap.put(operator, fd);
    }
633209
public static boolean hasOperationType(Operation operation, Class<? extends Operation> operationType)
    {
        if (operation == null)
            return false;

        if (operationType.isAssignableFrom(operation.getClass()))
            return true;

        if (operation instanceof CompositeOperation)
        {
            List<Operation> operations = ((CompositeOperation) operation).getOperations();
            for (Operation childOperation : operations)
            {
                if (hasOperationType(childOperation, operationType))
                    return true;
            }
        }

        return false;
    }
801865
private void applyExecute(ExecuteOperation operation) {
    Session session = context.getOrCreateSession(operation.session(), operation.node());
    if (operation.operation() != null) {
      try {
        context.service().apply(new DefaultCommit<>(
            context.setIndex(operation.index()),
            operation.operation().id(),
            operation.operation().value(),
            context.setSession(session),
            context.setTimestamp(operation.timestamp())));
      } catch (Exception e) {
        log.warn("Failed to apply operation: {}", e);
      } finally {
        context.setSession(null);
      }
    }
  }
745525
private synchronized void initCopy(CopyOperationImpl op) throws SQLException, IOException {
    pgStream.receiveInteger4(); // length not used
    int rowFormat = pgStream.receiveChar();
    int numFields = pgStream.receiveInteger2();
    int[] fieldFormats = new int[numFields];

    for (int i = 0; i < numFields; i++) {
      fieldFormats[i] = pgStream.receiveInteger2();
    }

    lock(op);
    op.init(this, rowFormat, fieldFormats);
  }
970531
private void indexWithRetry(final IndexRequest request, final String operationDescription) {

        try {
            new RetryUtil<IndexResponse>().retryOnException(() -> {
                try {
                    return elasticSearchClient.index(request);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }, null, null, RETRY_COUNT, operationDescription, "indexWithRetry");
        } catch (Exception e) {
            Monitors.error(className, "index");
            logger.error("Failed to index {} for request type: {}", request.id(), request.type(), e);
        }
    }
196863
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSInt enum_key_validator = new MPSInt();
		enum_key_validator.validate(operationType, enum_key, "\"enum_key\"");
		
		MPSString enum_value_validator = new MPSString();
		enum_value_validator.validate(operationType, enum_value, "\"enum_value\"");
		
	}
1256938
public void removeOverride(String operation) {
        if (this.overrideOnce.containsKey(operation) == true) {
            this.overrideOnce.remove(operation);
        }

        if (this.override.containsKey(operation) == true) {
            this.override.remove(operation);
        }
    }
1309250
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSString response_validator = new MPSString();
		response_validator.validate(operationType, response, "\"response\"");
		
		MPSIPAddress ns_ip_address_validator = new MPSIPAddress();
		ns_ip_address_validator.validate(operationType, ns_ip_address, "\"ns_ip_address\"");
		
	}