All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.datarouter.client.mysql.node.MysqlNode Maven / Gradle / Ivy

There is a newer version: 0.0.125
Show newest version
/*
 * Copyright © 2009 HotPads ([email protected])
 *
 * 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.
 */
package io.datarouter.client.mysql.node;

import java.util.Collection;

import io.datarouter.client.mysql.MysqlClientType;
import io.datarouter.model.databean.Databean;
import io.datarouter.model.index.IndexEntry;
import io.datarouter.model.key.primary.PrimaryKey;
import io.datarouter.model.key.unique.UniqueKey;
import io.datarouter.model.serialize.fielder.DatabeanFielder;
import io.datarouter.storage.config.Config;
import io.datarouter.storage.node.NodeParams;
import io.datarouter.storage.node.op.combo.IndexedSortedMapStorage.PhysicalIndexedSortedMapStorageNode;
import io.datarouter.storage.serialize.fieldcache.IndexEntryFieldInfo;

public class MysqlNode<
		PK extends PrimaryKey,
		D extends Databean,
		F extends DatabeanFielder>
extends MysqlReaderNode
implements PhysicalIndexedSortedMapStorageNode{

	private final MysqlNodeManager mysqlNodeManager;

	public MysqlNode(NodeParams params, MysqlClientType mysqlClientType, MysqlNodeManager mysqlNodeManager){
		super(params, mysqlClientType, mysqlNodeManager);
		this.mysqlNodeManager = mysqlNodeManager;
	}

	/*------------------------- MapStorageWriter methods --------------------*/

	@Override
	public void put(D databean, Config config){
		mysqlNodeManager.put(getFieldInfo(), databean, config);
	}

	@Override
	public void putMulti(Collection databeans, Config config){
		mysqlNodeManager.putMulti(getFieldInfo(), databeans, config);
	}

	@Override
	public void delete(PK key, Config config){
		mysqlNodeManager.delete(getFieldInfo(), key, config);
	}

	@Override
	public void deleteMulti(Collection keys, Config config){
		mysqlNodeManager.deleteMulti(getFieldInfo(), keys, config);
	}

	@Override
	public void deleteAll(Config config){
		mysqlNodeManager.deleteAll(getFieldInfo(), config);
	}

	@Override
	public void deleteUnique(UniqueKey uniqueKey, Config config){
		mysqlNodeManager.deleteUnique(getFieldInfo(), uniqueKey, config);
	}

	@Override
	public void deleteMultiUnique(Collection> uniqueKeys, Config config){
		mysqlNodeManager.deleteMultiUnique(getFieldInfo(), uniqueKeys, config);
	}

	@Override
	public ,
			IE extends IndexEntry,
			IF extends DatabeanFielder> void deleteByIndex(Collection keys, Config config,
			IndexEntryFieldInfo indexEntryFieldInfo){
		mysqlNodeManager.deleteByIndex(getFieldInfo(), keys, config, indexEntryFieldInfo);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy