Skip to content

Commit b7fb327

Browse files
author
Shoumik Palkar
committed
Adds Syncbase tutorial using Go Client API to website
Added tests, made the tutorial easy to follow (should work by just copying and pasting the fragments instead of having to manually copy and paste environment variables and endpoints). Change-Id: I4856775b6a3c4c08604490d567d18aed22611df5
1 parent 1079eba commit b7fb327

File tree

6 files changed

+891
-3
lines changed

6 files changed

+891
-3
lines changed

Makefile

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ tutCleanup = tutorials/cleanup
8989
tutWipeSlate = tutorials/wipe-slate
9090
tutHello = tutorials/hello-world
9191
tutBasics = tutorials/basics
92+
tutSyncbaseLocalPersist = tutorials/syncbase/localPersist
93+
tutSyncbaseSync = tutorials/syncbase/sync
9294
tutPrincipals = tutorials/security/principals-and-blessings
9395
tutPermsAuth = tutorials/security/permissions-authorizer
9496
tutCaveats1st = tutorials/security/first-party-caveats
@@ -118,6 +120,8 @@ completer = public/sh/tut-completer
118120
completerScripts = \
119121
$(completer)-hello-world.sh \
120122
$(completer)-basics.sh \
123+
$(completer)-syncbase-local-persist.sh \
124+
$(completer)-syncbase-sync.sh \
121125
$(completer)-permissions-authorizer.sh \
122126
$(completer)-custom-authorizer.sh \
123127
$(completer)-suffix-part1.sh \
@@ -133,7 +137,8 @@ setupScripts = \
133137
$(scenario)-b-setup.sh \
134138
$(scenario)-c-setup.sh \
135139
$(scenario)-d-setup.sh \
136-
$(scenario)-e-setup.sh
140+
$(scenario)-e-setup.sh \
141+
$(scenario)-f-setup.sh
137142

138143
depsCommon = \
139144
content/$(tutSetup).md \
@@ -268,6 +273,24 @@ $(completer)-basics.sh: $(depsBasics) | $(MDRIP)
268273
$(scenario)-b-setup.sh: $(completer)-basics.sh
269274
cp $^ $@
270275

276+
depsSyncbaseLocalPersist = $(depsBasics) content/$(tutSyncbaseLocalPersist).md
277+
.PHONY: test-syncbase-local-persist
278+
test-syncbase-local-persist: $(depsSyncbaseLocalPersist) | $(MDRIP)
279+
$(MDRIP) --subshell test $^
280+
$(completer)-syncbase-local-persist.sh: $(depsSyncbaseLocalPersist) | $(MDRIP)
281+
mkdir -p $(@D)
282+
$(MDRIP) --preambled 0 completer $^ > $@
283+
$(scenario)-f-setup.sh: $(completer)-syncbase-local-persist.sh
284+
cp $^ $@
285+
286+
depsSyncbaseSync = $(depsSyncbaseLocalPersist) content/$(tutSyncbaseSync).md
287+
.PHONY: test-syncbase-sync
288+
test-syncbase-sync: $(depsSyncbaseSync) | $(MDRIP)
289+
$(MDRIP) --subshell test $^
290+
$(completer)-syncbase-sync.sh: $(depsSyncbaseSync) | $(MDRIP)
291+
mkdir -p $(@D)
292+
$(MDRIP) --preambled 0 completer $^ > $@
293+
271294
depsPrincipals = $(depsBasics) content/$(tutPrincipals).md
272295
.PHONY: test-principals
273296
test-principals: $(depsPrincipals) | $(MDRIP)
@@ -378,7 +401,12 @@ depsOneBigCoreTutorialTest = \
378401
content/$(tutPrincipals).md \
379402
content/$(tutPermsAuth).md \
380403
content/$(tutSuffixPart1).md \
381-
content/$(tutSuffixPart2).md
404+
content/$(tutSuffixPart2).md \
405+
content/$(tutWipeSlate).md \
406+
content/$(tutBasics).md \
407+
content/$(tutSyncbaseLocalPersist).md \
408+
content/$(tutSyncbaseSync).md \
409+
382410

383411
# An ordering that lets us test all the Java tutorials faster than running the
384412
# individual tests in sequence.
@@ -470,4 +498,4 @@ test-tutorials-no-install: build
470498
# Change this to the desired version before running the target.
471499
SYNCBASE_ANDROID_VERSION=0.1.7
472500
upgrade-syncbase-android:
473-
find content/syncbase -type f -exec sed -i "s/\(compile 'io.v:syncbase:\)\(.*\)'/\1$(SYNCBASE_ANDROID_VERSION)'/g" {} \;
501+
find content/syncbase -type f -exec sed -i "s/\(compile 'io.v:syncbase:\)\(.*\)'/\1$(SYNCBASE_ANDROID_VERSION)'/g" {} \;

content/tutorials/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ title: Tutorials
1212
{{# content.tutorials.naming }}
1313
* [{{ title }}]({{ url }})
1414
{{/ content.tutorials.naming }}
15+
* [Syncbase Basics](/tutorials/syncbase/)
16+
{{# content.tutorials.syncbase }}
17+
* [{{ title }}]({{ url }})
18+
{{/ content.tutorials.syncbase }}
1519
* [Java](/tutorials/java/)
1620
{{# content.tutorials.java }}
1721
* [{{ title }}]({{ url }})

content/tutorials/syncbase/index.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
= yaml =
2+
title: Overview
3+
layout: tutorial
4+
sort: 30
5+
toc: false
6+
= yaml =
7+
8+
Syncbase provides a database that supports peer-to-peer synchronization built on
9+
top of Vanadium. It works even when devices are not connected to the Internet.
10+
11+
In the following tutorials, we will modify the code from the [basics tutorial]
12+
so it runs over Syncbase. This will allow us to synchronize our set of fortunes
13+
across multiple devices.
14+
15+
* [Persisting to Local Storage]<br> _Wherein_ fortunes are stored in a local
16+
Syncbase.
17+
18+
* [Exchanging Data]<br> _Wherein_ devices exchange their local data with each
19+
other.
20+
21+
These tutorials use a low level Syncbase API. The [Syncbase tutorial]
22+
complements this tutorial and uses a higher level API for mobile development
23+
which facilitates many of the patterns illustrated here.
24+
25+
[basics tutorial]: /tutorials/basics.html
26+
[Syncbase tutorial]: /syncbase/tutorial/introduction.html
27+
[Persisting to Local Storage]: /tutorials/syncbase/localPersist.html
28+
[Exchanging Data]: /tutorials/syncbase/sync.html
29+

0 commit comments

Comments
 (0)