forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
69 additions
and
4 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
syntax = "proto3"; | ||
|
||
option java_package = "castro.file"; | ||
option java_multiple_files = true; | ||
|
||
message FileLocation { | ||
string fileHash = 1; // git sha1 | ||
string repositoryId = 2; | ||
} | ||
|
||
message RichDocument { | ||
FileLocation fileLocation = 1; | ||
string path = 2; | ||
string fileContent = 3; | ||
repeated string nodes = 4; // TODO | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
syntax = "proto3"; | ||
|
||
option java_package = "castro.syntaxhighlight"; | ||
option java_multiple_files = true; | ||
|
||
import "File.proto"; | ||
|
||
message FileSyntaxHighlight { | ||
FileLocation fileLocation = 1; | ||
|
||
message LineSyntaxHight { | ||
int32 line = 1; | ||
repeated SyntaxHightTag tags = 2; | ||
} | ||
|
||
message SyntaxHightTag { | ||
int32 start = 1; | ||
int32 end = 2; | ||
string tag = 3; | ||
} | ||
} |
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,4 +1,4 @@ | ||
include 'logging' | ||
include 'util' | ||
include 'elasticsearch' | ||
|
||
include 'backend' | ||
|
File renamed without changes.
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,28 @@ | ||
package castro.hash; | ||
|
||
import java.io.UnsupportedEncodingException; | ||
import java.math.BigInteger; | ||
import java.security.MessageDigest; | ||
import java.security.NoSuchAlgorithmException; | ||
|
||
public class FileHash { | ||
// https://gist.github.com/alecthegeek/333663 | ||
String compute(String content) { | ||
try { | ||
var builder = new StringBuilder(); | ||
builder.append("blob "); | ||
builder.append(content.length()); | ||
builder.append("\0"); | ||
builder.append(content); | ||
var input = builder.toString().getBytes("UTF-8"); | ||
|
||
MessageDigest msdDigest = MessageDigest.getInstance("SHA-1"); | ||
msdDigest.update(input); | ||
BigInteger n = new BigInteger(msdDigest.digest()); | ||
return n.toString(16); | ||
} catch (UnsupportedEncodingException | NoSuchAlgorithmException e) { | ||
// Logger.getLogger(Encriptacion.class.getName()).log(Level.SEVERE, null, e); | ||
} | ||
return null; | ||
} | ||
} |
File renamed without changes.