Skip to content
This repository has been archived by the owner on May 23, 2019. It is now read-only.

Commit

Permalink
take advantage of default params now that I'm on 2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
davetron5000 committed Jul 18, 2010
1 parent 6cfe6d5 commit 545fce4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
10 changes: 3 additions & 7 deletions src/main/scala/shorty/db/DB.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import java.io._

import com.sleepycat.je._

import shorty.Logs

/** Access to a Berkeley DB.
* This is a low-level key/value interface.
* Use the DB object to create instances.
Expand Down Expand Up @@ -64,18 +66,12 @@ class DB(env:Environment,name:String) extends Logs {

/** Factory for DB instances */
object DB extends Logs {
/**
* Create a new DB instance with the default name, using the given dir.
* @param dir the directory where you want the db files created
*/
def apply(dir:File):DB = apply(dir,"shorty")

/**
* Create a new DB instance, using the given dir.
* @param dir the directory where you want the db files created
* @param name the name of the db, if you care
*/
def apply(dir:File, name:String) = {
def apply(dir:File, name:String = "shorty") = {
debug("Creating new DB " + name + " in " + dir)
if (!dir.exists()) {
info(dir.getAbsolutePath + " didnt exist, making it...")
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/shorty/db/URIHasher.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package shorty.db

import scala.actors._
import shorty.Logs

/**
* This hashes URIs to short character strings that we store
Expand Down Expand Up @@ -72,7 +73,6 @@ class URIHasher(database:DB, hasher: (String) => String) extends Actor with Logs
* Factory for creating URIHasher instances
*/
object URIHasher {
def apply(database:DB) = new URIHasher(database,new MessageDigestHasher("sha"))
def apply(database:DB,hasher:(String) => String) = new URIHasher(database,hasher)
def apply(database:DB,hasher:(String) => String = new MessageDigestHasher("sha")) = new URIHasher(database,hasher)
}

0 comments on commit 545fce4

Please sign in to comment.