/*
 * Copyright (c) 2013-2022 Cinchapi Inc.
 *
 * 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 com.cinchapi.concourse.server.storage.db.compaction;

import java.nio.file.Path;
import java.util.List;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

import com.cinchapi.concourse.server.storage.db.SegmentStorageSystem;
import com.cinchapi.concourse.server.storage.db.kernel.Segment;
import com.google.common.collect.ImmutableList;

/**
 * A {@link Compactor} that doesn't do anything.
 *
 * @author Jeff Nelson
 */
public final class NoOpCompactor extends Compactor {

    /**
     * Singleton.
     */
    private static NoOpCompactor INSTANCE = new NoOpCompactor(new SegmentStorageSystem() {

        @Override
        public long availableDiskSpace() {
            return 0;
        }

        @Override
        public Lock lock() {
            return new ReentrantLock();
        }

        @Override
        public Path save(Segment segment) {
            throw new UnsupportedOperationException("Cannot save "+segment);
        }

        @Override
        public List<Segment> segments() {
            return ImmutableList.of();
        }

        @Override
        public long totalDiskSpace() {
            return 0;
        }
        
    });

    /**
     * Return a {@link NoOpCompactor}
     * 
     * @return {@link NoOpCompactor}
     */
    public static NoOpCompactor instance() {
        return INSTANCE;
    }

    /**
     * Construct a new instance.
     * 
     * @param storage
     */
    private NoOpCompactor(SegmentStorageSystem storage) {
        super(storage);
    }

    @Override
    protected List<Segment> compact(Segment... segments) {
        return null;
    }
    

}

@@ -1213,16 +1213,29 @@
 mpactor(
+%0A            
 new Segm
@@ -1252,24 +1252,32 @@
 System() %7B%0A%0A
+        
         @Ove
@@ -1282,32 +1282,40 @@
 verride%0A        
+     
+   
 public long avai
@@ -1337,32 +1337,40 @@
 ) %7B%0A            
+        
 return 0;%0A      
@@ -1367,35 +1367,50 @@
  0;%0A        
+    
-%7D%0A%0A
+    %7D%0A%0A       
         
 @Override%0A  
@@ -1389,32 +1389,33 @@
 %0A               
+ 
 @Override%0A      
@@ -1400,32 +1400,40 @@
       @Override%0A
+        
         public L
@@ -1449,32 +1449,40 @@
 ) %7B%0A            
+    
+    
 return new Reent
@@ -1489,24 +1489,32 @@
 rantLock();%0A
+        
         %7D%0A%0A 
@@ -1512,32 +1512,40 @@
      %7D%0A%0A        
+ 
+       
 @Override%0A      
@@ -1542,24 +1542,32 @@
 ide%0A        
+      
+  
 public Path 
@@ -1586,24 +1586,32 @@
  segment) %7B%0A
+        
             
@@ -1650,16 +1650,45 @@
 ception(
+%0A                            
 %22Cannot 
@@ -1697,9 +1697,11 @@
 ve %22
-+
+ + 
 segm
@@ -1706,32 +1706,40 @@
 gment);%0A        
+    
+    
 %7D%0A%0A        @Over
@@ -1725,32 +1725,40 @@
      %7D%0A%0A        
+  
+      
 @Override%0A      
@@ -1751,32 +1751,40 @@
 verride%0A        
+       
+ 
 public List%3CSegm
@@ -1805,32 +1805,40 @@
 ) %7B%0A            
+        
 return Immutable
@@ -1848,35 +1848,51 @@
 t.of();%0A        
+    
-%7D%0A%0A
+    %7D%0A%0A        
         @Overrid
@@ -1893,32 +1893,40 @@
 verride%0A        
+ 
+       
 public long tota
@@ -1944,32 +1944,40 @@
 ) %7B%0A            
+      
+  
 return 0;%0A      
@@ -1974,25 +1974,34 @@
  0;%0A        
+    
-%7D
+    %7D%0A
 %0A        %0A  
@@ -1997,17 +1997,16 @@
         
-%0A
     %7D);%0A
@@ -2449,17 +2449,12 @@
 l;%0A    %7D
-%0A    
 %0A%0A%7D%0A

fix formatting