SlideShare una empresa de Scribd logo
1 de 36
Git muito além do
controle de versão
Alex Porcelli
Business Automation Architect, Red Hat
uma alternativa para armazenamento de dados
twitter.com/porcelli
github.com/porcelli
Git is the dominant choice for
version control for developers
today, with almost 90% of developers
checking in their code via Git
https://insights.stackoverflow.com/survey/2018
101
Bibiliotecas
Transações
Réplicas
Performance
Como Drools & jBPM
tooling utiliza git
como nosql?
//create new repository
FileSystem fs = FileSystems.newFileSystem(URI.create("git://repo);
//commits
Files.write(fs.getPath("/pom.xml"),
Files.readAllBytes(new File("input.xml").toPath()));
Files.write(fs.getPath("/dummyA/pom.xml"),
Files.readAllBytes(new File("inputA.xml").toPath()));
//list branches
fs.getRootDirectories();
# nio2 provider
Transações
Réplicas
Performance
Cluster
Alta Disponibilidade
# git init --bare .
Git is a content-
addressable filesystem.
# find objects
# find objects -type f
# echo ‘{content}' |
git hash-object -w
--stdin
# git cat-file –p
{hash}
# git cat-file –t
{hash}
# git update-index --
add --cacheinfo 100644
{hash} {path}
# git ls-files --stage
# git write-tree
tree
blob blob tree
blob
file1.txt
file2.txt
file3.txt
dir
# echo ‘{message}' |
git commit-tree {hash}
tree
blob blob tree
blob
file1.txt
file2.txt
file3.txt
dir
commit
# echo ‘{message}' | git
commit-tree {hash} –p
{previous_commit_hash}
# git cat-file –p
{hash}
# git log
fatal: your current branch
'master' does not have any
commits yet
# echo '{hash}' >
refs/heads/master
# git update-ref
refs/heads/master
{commit_hash}
# git log
# git update-ref
refs/heads/{branch_name}
{commit_hash}
# cat HEAD
# git symbolic-ref HEAD
# git symbolic-ref
HEAD refs/heads/test
Obrigado
Alex Porcelli
Business Automation Architect, Red Hat
twitter.com/porcelli
github.com/porcelli

Más contenido relacionado

Similar a TDC2018SP | Trilha NoSQL - Git muito alem do controle de versao, uma alternativa para armazenamento de dados

Rc094 010d-git 2 - desconocido
Rc094 010d-git 2 - desconocidoRc094 010d-git 2 - desconocido
Rc094 010d-git 2 - desconocido
Luis Bertel
 
Hadoop World 2011: Building Web Analytics Processing on Hadoop at CBS Interac...
Hadoop World 2011: Building Web Analytics Processing on Hadoop at CBS Interac...Hadoop World 2011: Building Web Analytics Processing on Hadoop at CBS Interac...
Hadoop World 2011: Building Web Analytics Processing on Hadoop at CBS Interac...
Cloudera, Inc.
 
What’s cool in the new and updated OSGi specs (DS, Cloud and more) - David Bo...
What’s cool in the new and updated OSGi specs (DS, Cloud and more) - David Bo...What’s cool in the new and updated OSGi specs (DS, Cloud and more) - David Bo...
What’s cool in the new and updated OSGi specs (DS, Cloud and more) - David Bo...
mfrancis
 

Similar a TDC2018SP | Trilha NoSQL - Git muito alem do controle de versao, uma alternativa para armazenamento de dados (20)

Basics of Git and Version Control
Basics of Git and Version ControlBasics of Git and Version Control
Basics of Git and Version Control
 
PoolParty Semantic Suite - Release 6.0 (Technical Overview)
PoolParty Semantic Suite - Release 6.0 (Technical Overview)PoolParty Semantic Suite - Release 6.0 (Technical Overview)
PoolParty Semantic Suite - Release 6.0 (Technical Overview)
 
Git introduction
Git introductionGit introduction
Git introduction
 
"Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko
"Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko "Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko
"Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko
 
Git introduction
Git introductionGit introduction
Git introduction
 
Git and Github
Git and GithubGit and Github
Git and Github
 
Git dvcs and Information Security Review
Git dvcs and Information Security ReviewGit dvcs and Information Security Review
Git dvcs and Information Security Review
 
Rc094 010d-git 2 - desconocido
Rc094 010d-git 2 - desconocidoRc094 010d-git 2 - desconocido
Rc094 010d-git 2 - desconocido
 
Git and github
Git and githubGit and github
Git and github
 
The journey to GitOps
The journey to GitOpsThe journey to GitOps
The journey to GitOps
 
R sharing 101
R sharing 101R sharing 101
R sharing 101
 
Webinar get move_on_with_bpmsuite6
Webinar get move_on_with_bpmsuite6Webinar get move_on_with_bpmsuite6
Webinar get move_on_with_bpmsuite6
 
AtoZ about TYPO3 v8 CMS
AtoZ about TYPO3 v8 CMSAtoZ about TYPO3 v8 CMS
AtoZ about TYPO3 v8 CMS
 
Software Build processes and Git
Software Build processes and GitSoftware Build processes and Git
Software Build processes and Git
 
Hadoop World 2011: Building Web Analytics Processing on Hadoop at CBS Interac...
Hadoop World 2011: Building Web Analytics Processing on Hadoop at CBS Interac...Hadoop World 2011: Building Web Analytics Processing on Hadoop at CBS Interac...
Hadoop World 2011: Building Web Analytics Processing on Hadoop at CBS Interac...
 
DrupalCafe Kyiv drupal8
DrupalCafe Kyiv drupal8DrupalCafe Kyiv drupal8
DrupalCafe Kyiv drupal8
 
What's cool in the new and updated OSGi specs
What's cool in the new and updated OSGi specsWhat's cool in the new and updated OSGi specs
What's cool in the new and updated OSGi specs
 
What’s cool in the new and updated OSGi specs (DS, Cloud and more) - David Bo...
What’s cool in the new and updated OSGi specs (DS, Cloud and more) - David Bo...What’s cool in the new and updated OSGi specs (DS, Cloud and more) - David Bo...
What’s cool in the new and updated OSGi specs (DS, Cloud and more) - David Bo...
 
Leveraging Open Source to Manage SAN Performance
Leveraging Open Source to Manage SAN PerformanceLeveraging Open Source to Manage SAN Performance
Leveraging Open Source to Manage SAN Performance
 
GitLab as an Alternative Development Platform for Github.com
GitLab as an Alternative Development Platform for Github.comGitLab as an Alternative Development Platform for Github.com
GitLab as an Alternative Development Platform for Github.com
 

Más de tdc-globalcode

Más de tdc-globalcode (20)

TDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidade
TDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidadeTDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidade
TDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidade
 
TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...
TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...
TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...
 
TDC2019 Intel Software Day - ACATE - Cases de Sucesso
TDC2019 Intel Software Day - ACATE - Cases de SucessoTDC2019 Intel Software Day - ACATE - Cases de Sucesso
TDC2019 Intel Software Day - ACATE - Cases de Sucesso
 
TDC2019 Intel Software Day - Otimizacao grafica com o Intel GPA
TDC2019 Intel Software Day - Otimizacao grafica com o Intel GPATDC2019 Intel Software Day - Otimizacao grafica com o Intel GPA
TDC2019 Intel Software Day - Otimizacao grafica com o Intel GPA
 
TDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVino
TDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVinoTDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVino
TDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVino
 
TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...
TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...
TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...
 
TDC2019 Intel Software Day - Inferencia de IA em edge devices
TDC2019 Intel Software Day - Inferencia de IA em edge devicesTDC2019 Intel Software Day - Inferencia de IA em edge devices
TDC2019 Intel Software Day - Inferencia de IA em edge devices
 
Trilha BigData - Banco de Dados Orientado a Grafos na Seguranca Publica
Trilha BigData - Banco de Dados Orientado a Grafos na Seguranca PublicaTrilha BigData - Banco de Dados Orientado a Grafos na Seguranca Publica
Trilha BigData - Banco de Dados Orientado a Grafos na Seguranca Publica
 
Trilha .Net - Programacao funcional usando f#
Trilha .Net - Programacao funcional usando f#Trilha .Net - Programacao funcional usando f#
Trilha .Net - Programacao funcional usando f#
 
TDC2018SP | Trilha Go - Case Easylocus
TDC2018SP | Trilha Go - Case EasylocusTDC2018SP | Trilha Go - Case Easylocus
TDC2018SP | Trilha Go - Case Easylocus
 
TDC2018SP | Trilha Modern Web - Para onde caminha a Web?
TDC2018SP | Trilha Modern Web - Para onde caminha a Web?TDC2018SP | Trilha Modern Web - Para onde caminha a Web?
TDC2018SP | Trilha Modern Web - Para onde caminha a Web?
 
TDC2018SP | Trilha Go - Clean architecture em Golang
TDC2018SP | Trilha Go - Clean architecture em GolangTDC2018SP | Trilha Go - Clean architecture em Golang
TDC2018SP | Trilha Go - Clean architecture em Golang
 
TDC2018SP | Trilha Go - "Go" tambem e linguagem de QA
TDC2018SP | Trilha Go - "Go" tambem e linguagem de QATDC2018SP | Trilha Go - "Go" tambem e linguagem de QA
TDC2018SP | Trilha Go - "Go" tambem e linguagem de QA
 
TDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendencia
TDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendenciaTDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendencia
TDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendencia
 
TDC2018SP | Trilha .Net - Real Time apps com Azure SignalR Service
TDC2018SP | Trilha .Net - Real Time apps com Azure SignalR ServiceTDC2018SP | Trilha .Net - Real Time apps com Azure SignalR Service
TDC2018SP | Trilha .Net - Real Time apps com Azure SignalR Service
 
TDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NET
TDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NETTDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NET
TDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NET
 
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
 
TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...
TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...
TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...
 
TDC2018SP | Trilha .Net - .NET funcional com F#
TDC2018SP | Trilha .Net - .NET funcional com F#TDC2018SP | Trilha .Net - .NET funcional com F#
TDC2018SP | Trilha .Net - .NET funcional com F#
 
TDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor em .Net Core
TDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor  em .Net CoreTDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor  em .Net Core
TDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor em .Net Core
 

Último

Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Último (20)

Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 

TDC2018SP | Trilha NoSQL - Git muito alem do controle de versao, uma alternativa para armazenamento de dados

Notas del editor

  1. Disclaimer: assim como todo nosql, não é todas as aplicações que se adequam ao uso do git como storage! SE FOR O SEU CASO, no mínimo vc vai sair daqui entendendo um pouco como Git funciona internamente! Então não tem como não sair daqui sem adicionar alguma coisa no seu dia a dia de desenvolvedor!
  2. Quem usa GIT aqui?
  3. StackOverflow insights 2018 87.2% (insights.stackoverflow.com) GitHub community reached 24 million developers working across 67 million repositories (https://octoverse.github.com)
  4. Agora… quem já se enrolou, principalmente no começo, com Git? Pensou que perdeu código… E depois descobriu que vc na vdd não perdeu... e procurando descobriyu coisas como reflog ou outras magias negras para recuperar suas alterações?!
  5. git init echo ‘hello’ > file1.txt git add . git commit -m "one more file" git branch my_branch git checkout my_branch echo ‘hello’ > file2.txt git add . git commit -m "one more file" git checkout master git merge my_branch git log Ainda tem: clone, push, pull, cherry-pick, stash, rebase, squash Mas vcs sacaram a idéia
  6. Git como armazenamento de dados Armazenamento de Arquivos, porém com recursos de versionamento, etc Exemplos: Content Management System, Document Management, Portal, etc Chave/valor Estrutura flexível para armazenamento de chave/valor, com recursos de versionamento Outras opções serão variações sobre essas opções
  7. Praticamente para todas as linguagens. Eu uso JGit para Java, que é mais que uma lib, é uma implementação complete do git em java. Libgit2, e binds para várias linguagens.
  8. Transação: commit forward only, se falhar, `rollback` -> Muitas alterações, usa uma branch, faz todas as alterações, e tenta fazer merge, se falhar: rollback. Réplica: Git post-commit hook Performance: tome cuidado com muito conteúdo em uma única árvore, e repos grandes são mais lentos. Commits por Segundo também não é muito rápido, toda operação vai no disco
  9. Utilizamos o git como forma de armazenamento de dados (6+ anos) - Primeiro
  10. Resultado: - Basta escrever tudo em arquivos - Teste unitário vc pode escrever no disco mesmo - Mapeamento quase completo em relação as funcionalidades do Git - Padrão, ninguém precisa aprender nada - E de graça…. Ainda resolvemos…
  11. Vc já se perguntou como Git funciona por baixo dos panos? Bom vamos começar por aqui, pois antes de eu falar sobre como vc pode usar e como eu uso Git como meu NOSQL nos últimos 6 anos, eh fundamenta vc entender como ele funciona
  12. Para os antigos usuários de Subversion, usar Git mudou a vida, pois branches e etc, passaram a ser utilizáveis… o Git era quase mágico de tão rápido para mudar branches. Early days do subversion armazenava reverse deltas, e tinha que computar os diffs. (Isso já mudou um bocado, mas talvez tarde demais). Git é diferente, é mais ou menos assim que os dados são armazenados.
  13. Então vamos começar pelo começo… o Repositório. Primeira coisa para entender: Bare e Working Tree Working Tree é a forma de você interagir com o Git de modo facilitado Bare: Bare é um repositório que você não tem o working tree Pq isso é importante? Pq se você quiser usar o git como nosql, vc provavelmente irá manipular diretamente as estruturas de dados, sem usar um Working Tree
  14. (retirado da documentação official) Ótimo! Mas o que isso significa? Significa que o core do Git é simplesmente um banco de dados chave-valor.
  15. Os dados no Git são armazenados como objetos. Para interagir diretamente com os objetos, vamos usar os commandos chamados plumbing!! Sim… existem dois tipos de comandos no Git: Porcelain e Plumbing. Porcelains são os que usamos inicialmente no 101: git add, git commit, git checkout, git branch
  16. echo 'hello' | git hash-object –stdin (não escreve) Cria um 40-character checksum hash do conteúdo, neste caso a palavra “hello” (write)
  17. Read content! E COM ISSO: Você já conhece o suficiente para pode usar Git como um K/V Store Ainda tem mais… vamos agora entender um pouco sobre tipos de objetos.
  18. Este commando retorna o tipo do Objeto! Sim, existe mais de um objeto… o que manipulamos até agora é o BLOB!
  19. 100644: arquivo normal 100755: arquivo executável 120000: link simbólico Essa estrutura fque estamos montando, é armazenada temporáriamente no index Interessante: path/ile.txt
  20. Mostrar dados que estão no index
  21. find objects -type f git cat-file {hash} -t
  22. Criando um commit
  23. Criando um commit seguido de outro commit!
  24. Visualizando um commit
  25. ERROR!!! fatal: your current branch 'master' does not have any commits yet
  26. WTF?!
  27. master branch é default, mas como é um repositório bare… e estamos manipulando ele diretamente…precisamos setar para onde o refs/head/master está apontado (commit hash)
  28. Agora funciona!
  29. Create a branch_name!!
  30. ref: refs/heads/master
  31. Apontando HEAD para a branch test
  32. THX!