This repository has been archived by the owner on Mar 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from PagerDuty/add-scalafmt
Add scalafmt
- Loading branch information
Showing
84 changed files
with
1,492 additions
and
1,414 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
verticalMultilineAtDefinitionSite = true | ||
maxColumn = 120 | ||
align.openParenCallSite = false | ||
danglingParentheses = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 9 additions & 8 deletions
17
common/src/main/scala/com/pagerduty/scheduler/Partitioner.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
package com.pagerduty.scheduler | ||
|
||
import com.pagerduty.scheduler.model.Task._ | ||
import org.apache.kafka.common.utils.{ Utils => KafkaUtils } | ||
import org.apache.kafka.common.utils.{Utils => KafkaUtils} | ||
|
||
/** | ||
* Created by cees on 2016/06/08. | ||
*/ | ||
* Created by cees on 2016/06/08. | ||
*/ | ||
object Partitioner { | ||
|
||
/** | ||
* This method calculates a Kafka partitionId for the given bytes. It is a direct copy of the | ||
* partitioning logic found in org.apache.kafka.clients.producer.internals.DefaultPartitioner. | ||
*/ | ||
* This method calculates a Kafka partitionId for the given bytes. It is a direct copy of the | ||
* partitioning logic found in org.apache.kafka.clients.producer.internals.DefaultPartitioner. | ||
*/ | ||
def partitionId(bytes: Array[Byte], numPartitions: Int): PartitionId = { | ||
toPositive(KafkaUtils.murmur2(bytes)) % numPartitions | ||
} | ||
|
||
/** | ||
* Again, this is a direct copy of the function in org.apache.kafka.clients.producer.internals.DefaultPartitioner | ||
*/ | ||
* Again, this is a direct copy of the function in org.apache.kafka.clients.producer.internals.DefaultPartitioner | ||
*/ | ||
private def toPositive(number: Int): Int = number & 0x7fffffff | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.