-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replace FBID with Identifier and remove retry in pipeline, I'll revis…
…it this later
- Loading branch information
1 parent
06cb256
commit 18dbb60
Showing
10 changed files
with
98 additions
and
91 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,53 @@ | ||
/* | ||
* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
package com.meta.chatbridge; | ||
|
||
import java.nio.charset.StandardCharsets; | ||
import java.util.Arrays; | ||
import java.util.Comparator; | ||
|
||
public class Identifier implements Comparator<Identifier> { | ||
|
||
private final byte[] id; | ||
|
||
private Identifier(byte[] id) { | ||
this.id = id; | ||
} | ||
|
||
public static Identifier from(String id) { | ||
return new Identifier(id.getBytes(StandardCharsets.UTF_8)); | ||
} | ||
|
||
public static Identifier from(long id) { | ||
return new Identifier(Long.toString(id).getBytes(StandardCharsets.UTF_8)); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return new String(id, StandardCharsets.UTF_8); | ||
} | ||
|
||
@Override | ||
public int compare(Identifier o1, Identifier o2) { | ||
return Comparator.<String>naturalOrder().compare(o1.toString(), o2.toString()); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
Identifier that = (Identifier) o; | ||
return Arrays.equals(id, that.id); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Arrays.hashCode(id); | ||
} | ||
} |
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
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
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
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