
org.joyqueue.nsr.journalkeeper.service.JournalkeeperPartitionGroupInternalService Maven / Gradle / Ivy
/**
* Copyright 2019 The JoyQueue Authors.
*
* 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 org.joyqueue.nsr.journalkeeper.service;
import org.joyqueue.domain.PartitionGroup;
import org.joyqueue.domain.TopicName;
import org.joyqueue.nsr.journalkeeper.converter.PartitionGroupConverter;
import org.joyqueue.nsr.journalkeeper.repository.PartitionGroupRepository;
import org.joyqueue.nsr.service.internal.PartitionGroupInternalService;
import java.util.List;
/**
* JournalkeeperPartitionGroupInternalService
* author: gaohaoxiang
* date: 2019/8/16
*/
public class JournalkeeperPartitionGroupInternalService implements PartitionGroupInternalService {
private PartitionGroupRepository partitionGroupRepository;
public JournalkeeperPartitionGroupInternalService(PartitionGroupRepository partitionGroupRepository) {
this.partitionGroupRepository = partitionGroupRepository;
}
@Override
public PartitionGroup getById(String id) {
return PartitionGroupConverter.convert(partitionGroupRepository.getById(id));
}
@Override
public PartitionGroup getByTopicAndGroup(TopicName topic, int group) {
return PartitionGroupConverter.convert(partitionGroupRepository.getByTopicAndGroup(topic.getCode(), topic.getNamespace(), group));
}
@Override
public List getByTopic(TopicName topic) {
return PartitionGroupConverter.convert(partitionGroupRepository.getByTopic(topic.getCode(), topic.getNamespace()));
}
@Override
public List getAll() {
return PartitionGroupConverter.convert(partitionGroupRepository.getAll());
}
@Override
public PartitionGroup add(PartitionGroup partitionGroup) {
return PartitionGroupConverter.convert(partitionGroupRepository.add(PartitionGroupConverter.convert(partitionGroup)));
}
@Override
public PartitionGroup update(PartitionGroup partitionGroup) {
return PartitionGroupConverter.convert(partitionGroupRepository.update(PartitionGroupConverter.convert(partitionGroup)));
}
@Override
public void delete(String id) {
partitionGroupRepository.deleteById(id);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy