<commit_before>package akashic.storage.service

import io.finch._
import akashic.storage.Server
import akashic.storage.service.Error.Reportable
import akashic.storage.files
import com.twitter.io.Buf
import com.google.common.net.HttpHeaders._

trait GetObjectSupport {
  self: Server =>
  object HeadObject {
   val matcher = head(string / string ?
      paramOption("versionId") ?
      paramOption("response-content-type") ?
      paramOption("response-content-language") ?
      paramOption("response-expires") ?
      paramOption("response-cache-control") ?
      paramOption("response-content-disposition") ?
      paramOption("response-content-encoding") ?
      RequestId.reader ?
      CallerId.reader ?
      RequestReader.value(false)
      ).as[GetObject.t]
   val endpoint = matcher { a: GetObject.t => a.run }
  }
  object GetObject {
    val matcher = get(string / string ?
      paramOption("versionId") ?
      paramOption("response-content-type") ?
      paramOption("response-content-language") ?
      paramOption("response-expires") ?
      paramOption("response-cache-control") ?
      paramOption("response-content-disposition") ?
      paramOption("response-content-encoding") ?
      RequestId.reader ?
      CallerId.reader ?
      RequestReader.value(true)
      ).as[t]
    val endpoint = matcher { a: t => a.run }

    case class t(
      bucketName: String, keyName: String,
      versionId: Option[String], // not used yet
      responseContentType: Option[String],
      responseContentLanguage: Option[String],
      responseExpires: Option[String],
      responseCacheControl: Option[String],
      responseContentDisposition: Option[String],
      responseContentEncoding: Option[String],
      requestId: String,
      callerid: String,
      withContent: Boolean
    ) extends Task[Output[Buf]] with Reportable {
      def name = "GET Object"
      def resource = Resource.forObject(bucketName, keyName)
      def runOnce = {
        val bucket = findBucket(tree, bucketName)
        val key = findKey(bucket, keyName)
        val version = key.findLatestVersion match {
          case Some(a) => a
          case None => failWith(Error.NoSuchKey())
        }
        // TODO if this is a delete marker?

        val meta = Meta.fromBytes(version.meta.readBytes)
        <commit_msg>separete labels<commit_after>package akashic.storage.service

import io.finch._
import akashic.storage.Server
import akashic.storage.service.Error.Reportable
import akashic.storage.files
import com.twitter.io.Buf
import com.google.common.net.HttpHeaders._

trait GetObjectSupport {
  self: Server =>
  object HeadObject {
   val matcher = head(string / string ?
      paramOption("versionId") ?
      paramOption("response-content-type") ?
      paramOption("response-content-language") ?
      paramOption("response-expires") ?
      paramOption("response-cache-control") ?
      paramOption("response-content-disposition") ?
      paramOption("response-content-encoding") ?
      RequestId.reader ?
      CallerId.reader ?
      RequestReader.value(false) ?
      RequestReader.value("Head Object")
      ).as[GetObject.t]
   val endpoint = matcher { a: GetObject.t => a.run }
  }
  object GetObject {
    val matcher = get(string / string ?
      paramOption("versionId") ?
      paramOption("response-content-type") ?
      paramOption("response-content-language") ?
      paramOption("response-expires") ?
      paramOption("response-cache-control") ?
      paramOption("response-content-disposition") ?
      paramOption("response-content-encoding") ?
      RequestId.reader ?
      CallerId.reader ?
      RequestReader.value(true) ?
      RequestReader.value("Get Object")
      ).as[t]
    val endpoint = matcher { a: t => a.run }

    case class t(
      bucketName: String, keyName: String,
      versionId: Option[String], // not used yet
      responseContentType: Option[String],
      responseContentLanguage: Option[String],
      responseExpires: Option[String],
      responseCacheControl: Option[String],
      responseContentDisposition: Option[String],
      responseContentEncoding: Option[String],
      requestId: String,
      callerid: String,
      withContent: Boolean,
      label: String
    ) extends Task[Output[Buf]] with Reportable {
      def name = label
      def resource = Resource.forObject(bucketName, keyName)
      def runOnce = {
        val bucket = findBucket(tree, bucketName)
        val key = findKey(bucket, keyName)
        val version = key.findLatestVersion match {
          case Some(a) => a
          case None => failWith(Error.NoSuchKey())
        }
        // TODO if this is a delete marker?

        val meta = Meta.fromBytes(version.meta.readBytes)
        
{'fraction_non_alphanumeric': 0.11061853493772429, 'fraction_numerical': 0.0, 'mean_word_length': 2.9781696053736355, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3521164', 'n_tokens_mistral': 1323, 'n_tokens_neox': 1322, 'n_words': 278}