mirror of
https://github.com/torproject/collector.git
synced 2024-11-26 19:00:38 +00:00
Remove dependency on metrics-lib's log package (3/4).
- Remove package-internal interfaces InternalLogDescriptor and InternalWebServerAccessLog.
This commit is contained in:
parent
ea1b1b4f6a
commit
c11b61465a
@ -5,7 +5,7 @@ package org.torproject.metrics.collector.persist;
|
||||
|
||||
import org.torproject.descriptor.WebServerAccessLog;
|
||||
import org.torproject.metrics.collector.webstats.FileType;
|
||||
import org.torproject.metrics.collector.webstats.InternalWebServerAccessLog;
|
||||
import org.torproject.metrics.collector.webstats.WebServerAccessLogImpl;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
@ -14,7 +14,7 @@ import java.time.format.DateTimeFormatter;
|
||||
public class WebServerAccessLogPersistence
|
||||
extends DescriptorPersistence<WebServerAccessLog> {
|
||||
|
||||
public static final String SEP = InternalWebServerAccessLog.SEP;
|
||||
public static final String SEP = WebServerAccessLogImpl.SEP;
|
||||
public static final FileType COMPRESSION = FileType.XZ;
|
||||
|
||||
private DateTimeFormatter yearPattern = DateTimeFormatter.ofPattern("yyyy");
|
||||
|
@ -1,28 +0,0 @@
|
||||
/* Copyright 2017--2018 The Tor Project
|
||||
* See LICENSE for licensing information */
|
||||
|
||||
package org.torproject.metrics.collector.webstats;
|
||||
|
||||
import org.torproject.descriptor.LogDescriptor;
|
||||
|
||||
/**
|
||||
* This interface provides methods for internal use only.
|
||||
*
|
||||
* @since 2.2.0
|
||||
*/
|
||||
public interface InternalLogDescriptor extends LogDescriptor {
|
||||
|
||||
/** Logfile name parts separator. */
|
||||
String SEP = "_";
|
||||
|
||||
/**
|
||||
* Set the descriptor's bytes.
|
||||
*
|
||||
* @since 2.2.0
|
||||
*/
|
||||
void setRawDescriptorBytes(byte[] bytes);
|
||||
|
||||
/** Return the descriptor's preferred compression. */
|
||||
String getCompressionType();
|
||||
}
|
||||
|
@ -1,17 +0,0 @@
|
||||
/* Copyright 2018 The Tor Project
|
||||
* See LICENSE for licensing information */
|
||||
|
||||
package org.torproject.metrics.collector.webstats;
|
||||
|
||||
/**
|
||||
* This interface provides methods for internal use only.
|
||||
*
|
||||
* @since 2.2.0
|
||||
*/
|
||||
public interface InternalWebServerAccessLog extends InternalLogDescriptor {
|
||||
|
||||
/** The log's name should include this string. */
|
||||
String MARKER = "access.log";
|
||||
|
||||
}
|
||||
|
@ -20,8 +20,10 @@ import java.util.regex.Pattern;
|
||||
*
|
||||
* @since 2.2.0
|
||||
*/
|
||||
public abstract class LogDescriptorImpl
|
||||
implements LogDescriptor, InternalLogDescriptor {
|
||||
public abstract class LogDescriptorImpl implements LogDescriptor {
|
||||
|
||||
/** Logfile name parts separator. */
|
||||
public static final String SEP = "_";
|
||||
|
||||
/** The log's file name should contain this string. */
|
||||
public static final String MARKER = ".log";
|
||||
@ -78,7 +80,6 @@ public abstract class LogDescriptorImpl
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCompressionType() {
|
||||
return this.fileType.name().toLowerCase();
|
||||
}
|
||||
@ -88,7 +89,6 @@ public abstract class LogDescriptorImpl
|
||||
return this.logBytes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRawDescriptorBytes(byte[] bytes) {
|
||||
this.logBytes = bytes;
|
||||
}
|
||||
|
@ -135,9 +135,9 @@ public class SanitizeWeblogs extends CollecTorMain {
|
||||
|
||||
private void storeSortedAndForget(String virtualHost, String physicalHost,
|
||||
LocalDate date, Map<String, Long> lineCounts) {
|
||||
String name = new StringJoiner(InternalLogDescriptor.SEP)
|
||||
String name = new StringJoiner(LogDescriptorImpl.SEP)
|
||||
.add(virtualHost).add(physicalHost)
|
||||
.add(InternalWebServerAccessLog.MARKER)
|
||||
.add(WebServerAccessLogImpl.MARKER)
|
||||
.add(date.format(DateTimeFormatter.BASIC_ISO_DATE))
|
||||
.toString() + "." + FileType.XZ.name().toLowerCase();
|
||||
log.debug("Storing {}.", name);
|
||||
|
@ -27,10 +27,10 @@ import java.util.stream.Stream;
|
||||
* @since 2.2.0
|
||||
*/
|
||||
public class WebServerAccessLogImpl extends LogDescriptorImpl
|
||||
implements InternalWebServerAccessLog, WebServerAccessLog {
|
||||
implements WebServerAccessLog {
|
||||
|
||||
/** The log's name should include this string. */
|
||||
public static final String MARKER = InternalWebServerAccessLog.MARKER;
|
||||
public static final String MARKER = "access.log";
|
||||
|
||||
/** The mandatory web server log descriptor file name pattern. */
|
||||
public static final Pattern filenamePattern
|
||||
|
Loading…
Reference in New Issue
Block a user