Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

Remove Link #780

Merged
merged 180 commits into from
Feb 12, 2019
Merged
Show file tree
Hide file tree
Changes from 165 commits
Commits
Show all changes
180 commits
Select commit Hold shift + click to select a range
bce8cc1
Removelink definition
StaticallyTypedAnxiety Dec 18, 2018
2508f7f
changed signature
StaticallyTypedAnxiety Dec 18, 2018
f2a6043
Implemented remove_eav
StaticallyTypedAnxiety Dec 18, 2018
6870c86
Merge branch 'develop' into remove_link
StaticallyTypedAnxiety Dec 18, 2018
a3d3b29
Implemented dht_reducer for remove_link
StaticallyTypedAnxiety Dec 19, 2018
1a3036a
Added RemoveLink Future
StaticallyTypedAnxiety Dec 19, 2018
cf910ba
Cargo fmt
StaticallyTypedAnxiety Dec 19, 2018
79ac2b3
Merge branch 'develop' into remove_link
StaticallyTypedAnxiety Dec 19, 2018
dfe7677
Merge branch 'develop' into remove_link
StaticallyTypedAnxiety Jan 22, 2019
410289b
Merge conflicts resolved
StaticallyTypedAnxiety Jan 25, 2019
d9ef1ec
cargo fmt
StaticallyTypedAnxiety Jan 25, 2019
206e8ce
Added remove_link reducer
StaticallyTypedAnxiety Jan 28, 2019
01a003b
Merge branch 'develop' into remove_link
StaticallyTypedAnxiety Jan 28, 2019
4d91581
Imeplemted remove_link test
StaticallyTypedAnxiety Jan 28, 2019
665578b
Add removelink in waiter
StaticallyTypedAnxiety Jan 28, 2019
87f591f
remove_link workflow added
StaticallyTypedAnxiety Jan 28, 2019
38aa709
cargo fmt
StaticallyTypedAnxiety Jan 28, 2019
0903287
Added prefix ability to index query
StaticallyTypedAnxiety Jan 29, 2019
1530121
Implemented allowed values
StaticallyTypedAnxiety Jan 30, 2019
ec91526
Merge branch 'develop' into remove_link
StaticallyTypedAnxiety Jan 30, 2019
00489f0
remove pritnlns
StaticallyTypedAnxiety Jan 30, 2019
f24cf5a
index_query added on get_links
StaticallyTypedAnxiety Jan 30, 2019
e258a2c
changes to workflow and ribosome funciton for remove_link
StaticallyTypedAnxiety Jan 31, 2019
86ba14f
Made some changes to zomeapifunctions
StaticallyTypedAnxiety Feb 1, 2019
9e31bc7
restrucutered zome ordering
StaticallyTypedAnxiety Feb 1, 2019
6470cac
Implemented app-spec tests and hdk
StaticallyTypedAnxiety Feb 1, 2019
0b334f3
cargo fmt
StaticallyTypedAnxiety Feb 1, 2019
d90dffc
Removed unused imports
StaticallyTypedAnxiety Feb 1, 2019
881ec74
Changes to nodejs_waiter
StaticallyTypedAnxiety Feb 1, 2019
5205a98
updated dht_reducer
StaticallyTypedAnxiety Feb 1, 2019
f94dd80
eav changes
StaticallyTypedAnxiety Feb 1, 2019
b881cd1
fiuxed app-spec tests
StaticallyTypedAnxiety Feb 1, 2019
99785e9
Change around zome code
StaticallyTypedAnxiety Feb 2, 2019
1839268
Change to zome
StaticallyTypedAnxiety Feb 2, 2019
d0130d3
Update app_spec/test/test.js
Feb 4, 2019
9fd38e9
Merge branch 'develop' into remove_link
StaticallyTypedAnxiety Feb 4, 2019
c0efbfa
Merge branch 'remove_link' of https://github.com/holochain/holochain-…
StaticallyTypedAnxiety Feb 4, 2019
be3e4f6
Updated test.js
StaticallyTypedAnxiety Feb 4, 2019
4afecd9
added tests to hdk
StaticallyTypedAnxiety Feb 5, 2019
5448d0b
cargo fmt
StaticallyTypedAnxiety Feb 5, 2019
6e94040
Commit merge
StaticallyTypedAnxiety Feb 5, 2019
27fb579
merge commit
StaticallyTypedAnxiety Feb 5, 2019
bed52fa
App-spec added to capabilities
StaticallyTypedAnxiety Feb 5, 2019
7936612
from merge
StaticallyTypedAnxiety Feb 5, 2019
e22ffcd
from merge
StaticallyTypedAnxiety Feb 5, 2019
1b06232
changed entry
StaticallyTypedAnxiety Feb 5, 2019
99897bd
Merge branch 'develop' into remove_link
StaticallyTypedAnxiety Feb 5, 2019
b485182
app_spec tests
StaticallyTypedAnxiety Feb 5, 2019
9d980e1
Merge branch 'remove_link' of https://github.com/holochain/holochain-…
StaticallyTypedAnxiety Feb 5, 2019
ea82a79
changes to app_spec
StaticallyTypedAnxiety Feb 5, 2019
f1d9585
Update remove_link
StaticallyTypedAnxiety Feb 5, 2019
c2413cb
update remove_link
StaticallyTypedAnxiety Feb 5, 2019
2cf41bd
validation changes
StaticallyTypedAnxiety Feb 5, 2019
9146952
cargo fmt
StaticallyTypedAnxiety Feb 5, 2019
14fff01
cargo fmt
StaticallyTypedAnxiety Feb 5, 2019
90612c8
updated remove_link
StaticallyTypedAnxiety Feb 5, 2019
0845fc5
Update remove_link
StaticallyTypedAnxiety Feb 5, 2019
4fffcc4
changes to zome
StaticallyTypedAnxiety Feb 5, 2019
721df5d
Update blog.rs
StaticallyTypedAnxiety Feb 5, 2019
3fd9b9f
Update remove_link.rs
StaticallyTypedAnxiety Feb 5, 2019
5c60d76
validate link_remove
StaticallyTypedAnxiety Feb 5, 2019
1091753
Updated document comments
StaticallyTypedAnxiety Feb 6, 2019
488b436
updated
StaticallyTypedAnxiety Feb 6, 2019
fe6e94d
Update validation_package.rs
StaticallyTypedAnxiety Feb 6, 2019
97e01b6
Update validation_package.rs
StaticallyTypedAnxiety Feb 6, 2019
082c9b2
App-spec debug
StaticallyTypedAnxiety Feb 7, 2019
87a40cc
Update author_entry.rs
StaticallyTypedAnxiety Feb 7, 2019
026607d
Update author_entry.rs
StaticallyTypedAnxiety Feb 7, 2019
1a31f8f
Update test.js
StaticallyTypedAnxiety Feb 7, 2019
63fa43f
Update test.js
StaticallyTypedAnxiety Feb 7, 2019
561133d
Update test.js
StaticallyTypedAnxiety Feb 7, 2019
2a9048f
Update test.js
StaticallyTypedAnxiety Feb 7, 2019
b283809
clean up changes
StaticallyTypedAnxiety Feb 7, 2019
213d143
Remove fluff
StaticallyTypedAnxiety Feb 7, 2019
f03fb13
Better error handling on fold
StaticallyTypedAnxiety Feb 7, 2019
ccd4f46
fixed merge
StaticallyTypedAnxiety Feb 7, 2019
725a00e
Update remove_link.rs
StaticallyTypedAnxiety Feb 7, 2019
44d19b6
used is_empty better
StaticallyTypedAnxiety Feb 7, 2019
6ff187f
Fixed extra brace
StaticallyTypedAnxiety Feb 7, 2019
2215748
Cargo fmt
StaticallyTypedAnxiety Feb 7, 2019
de88314
Delete tmp-test_add_instance-container-config.toml
StaticallyTypedAnxiety Feb 7, 2019
b43b89d
Delete tmp-test_install_dna_from_file-container-config.toml
StaticallyTypedAnxiety Feb 7, 2019
ca09aa9
Delete tmp-test_remove_instance-container-config.toml
StaticallyTypedAnxiety Feb 7, 2019
b93f4ff
Delete tmp-test_uninstall_dna-container-config.toml
StaticallyTypedAnxiety Feb 7, 2019
180c25b
Removed node modules
StaticallyTypedAnxiety Feb 7, 2019
74f4c96
Removed contianer reminants
StaticallyTypedAnxiety Feb 7, 2019
38115a4
Update Cargo.toml
StaticallyTypedAnxiety Feb 7, 2019
e3f2e0d
clean up
StaticallyTypedAnxiety Feb 7, 2019
8726162
Update eav.rs
StaticallyTypedAnxiety Feb 7, 2019
eaf9967
Update macros.rs
StaticallyTypedAnxiety Feb 7, 2019
dc429d8
Update context.rs
StaticallyTypedAnxiety Feb 7, 2019
5334884
Update core_types/src/eav.rs
sphinxc0re Feb 7, 2019
e4ab912
Update macros.rs
StaticallyTypedAnxiety Feb 7, 2019
ef3160f
Merge branch 'remove_link' of https://github.com/holochain/holochain-…
StaticallyTypedAnxiety Feb 7, 2019
6013f96
Merge branch 'develop' into remove_link
StaticallyTypedAnxiety Feb 7, 2019
24c510c
Merge branch 'develop' into remove_link
StaticallyTypedAnxiety Feb 7, 2019
a1e9bca
Merge branch 'develop' into remove_link
StaticallyTypedAnxiety Feb 8, 2019
a804279
using author entry instead of direct remove_link workflow
StaticallyTypedAnxiety Feb 8, 2019
21c3fb6
Merge branch 'remove_link' of https://github.com/holochain/holochain-…
StaticallyTypedAnxiety Feb 8, 2019
c955ce4
cargo fmt
StaticallyTypedAnxiety Feb 8, 2019
d4f1f15
app_spec debug
StaticallyTypedAnxiety Feb 8, 2019
1f6b7e2
unute logs for test
StaticallyTypedAnxiety Feb 8, 2019
a260cfb
updated
StaticallyTypedAnxiety Feb 8, 2019
fdce4a5
Multinode_app_spec test
StaticallyTypedAnxiety Feb 8, 2019
724586e
changes to linkAdd
StaticallyTypedAnxiety Feb 8, 2019
48d2cfe
uupdated LinkActionKind
StaticallyTypedAnxiety Feb 8, 2019
2cab38f
updated Link_add
StaticallyTypedAnxiety Feb 8, 2019
6f4f6bb
link_data changes
StaticallyTypedAnxiety Feb 8, 2019
7d801ec
cargo fmt
StaticallyTypedAnxiety Feb 8, 2019
38643fe
Update waiter.rs
StaticallyTypedAnxiety Feb 8, 2019
31ce29d
Update waiter.rs
StaticallyTypedAnxiety Feb 8, 2019
d28e796
Fixed merge conflict
StaticallyTypedAnxiety Feb 8, 2019
afc1dea
Update shell.nix
StaticallyTypedAnxiety Feb 8, 2019
4af6f2b
Merge branch 'develop' into remove_link
StaticallyTypedAnxiety Feb 8, 2019
c7420b0
Merge branch 'develop' into remove_link
StaticallyTypedAnxiety Feb 11, 2019
aefdbc8
Fixed app_spec merge conflicts
StaticallyTypedAnxiety Feb 11, 2019
d91654d
Update lib.rs
StaticallyTypedAnxiety Feb 11, 2019
81230e3
Update core/src/dht/dht_reducers.rs
zippy Feb 11, 2019
5b99a8f
Update core/src/workflows/remove_link.rs
Feb 11, 2019
2ec9b6f
Update core/src/network/handler/store.rs
Feb 11, 2019
272c0c5
Update app_spec/test/test.js
Feb 11, 2019
83585ab
Added test for eavi prefixes
StaticallyTypedAnxiety Feb 11, 2019
707f17a
workflow_link_tests
StaticallyTypedAnxiety Feb 11, 2019
7e5817b
cargo fmt
StaticallyTypedAnxiety Feb 11, 2019
98a5c15
Merge branch 'remove_link' of https://github.com/holochain/holochain-…
StaticallyTypedAnxiety Feb 11, 2019
97a9640
removed println
StaticallyTypedAnxiety Feb 11, 2019
a88bffe
New app_spec test
StaticallyTypedAnxiety Feb 11, 2019
c32000a
app_spec_for_debug
StaticallyTypedAnxiety Feb 11, 2019
c143b1e
cargo fmt
StaticallyTypedAnxiety Feb 11, 2019
9aaeb35
Update storage.rs
StaticallyTypedAnxiety Feb 11, 2019
f994df9
Update test.js
StaticallyTypedAnxiety Feb 11, 2019
1fe629c
Update test.js
StaticallyTypedAnxiety Feb 11, 2019
eb1eb64
Update app_spec/zomes/blog/code/src/lib.rs
maackle Feb 11, 2019
2619d56
Update app_spec/zomes/blog/code/src/blog.rs
maackle Feb 11, 2019
5265de4
app spec delete
StaticallyTypedAnxiety Feb 11, 2019
f7bba1d
Merge branch 'remove_link' of https://github.com/holochain/holochain-…
StaticallyTypedAnxiety Feb 11, 2019
f4d69a9
Update test.js
StaticallyTypedAnxiety Feb 11, 2019
1b18319
Update test.js
StaticallyTypedAnxiety Feb 11, 2019
ba8078b
Update test.js
StaticallyTypedAnxiety Feb 11, 2019
9aa1f1d
Update test.js
StaticallyTypedAnxiety Feb 11, 2019
419e2b9
app_spec changes
StaticallyTypedAnxiety Feb 12, 2019
9bc3596
Update test.js
StaticallyTypedAnxiety Feb 12, 2019
b8cbec9
Update lib.rs
StaticallyTypedAnxiety Feb 12, 2019
9c3fa4d
Update test.js
StaticallyTypedAnxiety Feb 12, 2019
5c85440
Update test.js
StaticallyTypedAnxiety Feb 12, 2019
447d98e
Update test.js
StaticallyTypedAnxiety Feb 12, 2019
6cc5a43
app_spec debug
StaticallyTypedAnxiety Feb 12, 2019
496346e
app_spec debug
StaticallyTypedAnxiety Feb 12, 2019
0d16587
Update test.js
StaticallyTypedAnxiety Feb 12, 2019
494d2bd
Update test.js
StaticallyTypedAnxiety Feb 12, 2019
c734ce9
app_spec debug
StaticallyTypedAnxiety Feb 12, 2019
e139454
Update test.js
StaticallyTypedAnxiety Feb 12, 2019
e8b45aa
Update test.js
StaticallyTypedAnxiety Feb 12, 2019
7809916
Update test.js
StaticallyTypedAnxiety Feb 12, 2019
f8de250
Update test.js
StaticallyTypedAnxiety Feb 12, 2019
27fcd00
Update test.js
StaticallyTypedAnxiety Feb 12, 2019
b24270b
Update test.js
StaticallyTypedAnxiety Feb 12, 2019
3706b46
Update test.js
StaticallyTypedAnxiety Feb 12, 2019
bba7175
Update test.js
StaticallyTypedAnxiety Feb 12, 2019
43e7930
Update test.js
StaticallyTypedAnxiety Feb 12, 2019
208b4f9
Update test.js
StaticallyTypedAnxiety Feb 12, 2019
c923244
Update test.js
StaticallyTypedAnxiety Feb 12, 2019
c3c7bba
Update test.js
StaticallyTypedAnxiety Feb 12, 2019
e39fef6
Update test.js
StaticallyTypedAnxiety Feb 12, 2019
caba2b0
Update test.js
StaticallyTypedAnxiety Feb 12, 2019
89183c7
Update test.js
StaticallyTypedAnxiety Feb 12, 2019
d3195e9
Update test.js
StaticallyTypedAnxiety Feb 12, 2019
eb266c0
updated to test
StaticallyTypedAnxiety Feb 12, 2019
7dd5a66
implemented app_spec test
StaticallyTypedAnxiety Feb 12, 2019
a720527
removed invalid syntax
StaticallyTypedAnxiety Feb 12, 2019
2df9447
changed from unwrap_or to unwrap_or_default
StaticallyTypedAnxiety Feb 12, 2019
0064d07
Update eav.rs
StaticallyTypedAnxiety Feb 12, 2019
a7ae19a
Merge branch 'develop' into remove_link
zippy Feb 12, 2019
4f4fe72
changed to use if let
StaticallyTypedAnxiety Feb 12, 2019
84f241b
Merge branch 'remove_link' of https://github.com/holochain/holochain-…
StaticallyTypedAnxiety Feb 12, 2019
efc4de1
Update app_spec/test/test.js
Feb 12, 2019
c089f53
removed trailing spaces
StaticallyTypedAnxiety Feb 12, 2019
c5a7bc3
removed trailing spaces
StaticallyTypedAnxiety Feb 12, 2019
bcae33e
Revert "removed trailing spaces"
StaticallyTypedAnxiety Feb 12, 2019
99be951
Revert "removed trailing spaces"
StaticallyTypedAnxiety Feb 12, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 65 additions & 23 deletions app_spec/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const scenario1 = new Scenario([instanceAlice])
const scenario2 = new Scenario([instanceAlice, instanceBob])
const scenario3 = new Scenario([instanceAlice, instanceBob, instanceCarol])

scenario2.runTape('agentId', async (t, { alice, bob }) => {
/*scenario2.runTape('agentId', async (t, { alice, bob }) => {
t.ok(alice.agentId)
t.notEqual(alice.agentId, bob.agentId)
})
Expand Down Expand Up @@ -77,29 +77,55 @@ scenario1.runTape('create_post', async (t, { alice }) => {
t.ok(result.Ok)
t.notOk(result.Err)
t.equal(result.Ok, "QmY6MfiuhHnQ1kg7RwNZJNUQhwDxTFL45AAPnpJMNPEoxk")
})


scenario1.runTape('delete_post', async (t, { alice }) => {
t.plan(3)

const content = "Hello Holo world 321"
const in_reply_to = null
const params = { content, in_reply_to }
const createResult = alice.call("blog", "create_post", params)
})*/

t.ok(createResult.Ok)
scenario2.runTape('delete_post', async (t, { alice, bob }) => {

const deletionParams = { post_address: createResult.Ok }
const deletionResult = alice.call("blog", "delete_post", deletionParams)
//create post
await alice.callSync("blog", "create_post",
{ "content": "Posty", "in_reply_to": "" }
)

t.equals(deletionResult.Ok, null)

// get posts by bob
const bob_agent_posts = bob.call("blog", "my_posts", {})

const paramsGet = { post_address: createResult.Ok }
const result = alice.call("blog", "get_post", paramsGet)
t.ok(bob_agent_posts.Ok)
t.equal(bob_agent_posts.Ok.addresses.length, 1);

t.equals(result.Ok, null)
})
//remove link by alicce
await alice.callSync("blog", "delete_post",
{ "content": "Posty", "in_reply_to": "" }
)

// get posts by bob
const bob_agent_posts = bob.call("blog", "my_posts", {})

t.Ok(bob_agent_posts.Ok)
t.equal(bob_agent_posts.Ok.addresses.length, 0);

})

/*scenario1.runTape('delete_entry_post', async (t, { alice }) => {
t.plan(3)

const content = "Hello Holo world 321"
const in_reply_to = null
const params = { content, in_reply_to }
const createResult = alice.call("blog", "create_post", params)

t.ok(createResult.Ok)

const deletionParams = { post_address: createResult.Ok }
const deletionResult = alice.call("blog", "delete_entry_post", deletionParams)

t.equals(deletionResult.Ok, null)

const paramsGet = { post_address: createResult.Ok }
const result = alice.call("blog", "get_post", paramsGet)

t.equals(result.Ok, null)
})

scenario1.runTape('update_post', async (t, { alice }) => {
t.plan(4)
Expand All @@ -123,7 +149,7 @@ scenario1.runTape('update_post', async (t, { alice }) => {
t.deepEqual(JSON.parse(updatedPost.Ok.App[1]), { content: "Hello Holo", date_created: "now" })
})

scenario1.runTape('create_post with bad reply to', async (t, { alice }) => {
scenario1.runTape('create_post with bad reply to', async (t, { alice }) => {
t.plan(5)

const content = "Holo world"
Expand All @@ -138,9 +164,25 @@ scenario1.runTape('create_post with bad reply to', async (t, { alice }) => {
t.deepEqual(error.kind, { ErrorGeneric: "Base for link not found" })
t.ok(error.file)
t.equal(error.line, "94")
})
})*/

/*scenario2.runTape('delete_post_with_bad_link', async (t, { alice, bob }) => {

scenario1.runTape('post max content size 280 characters', async (t, { alice }) => {
const result_bob_delete = await bob.callSync("blog", "delete_post",
{ "content": "Bad"}
)

// bad in_reply_to is an error condition
t.ok(result_bob_delete.Err)
t.notOk(result_bob_delete.Ok)
const error = JSON.parse(result_bob_delete.Err.Internal)
t.deepEqual(error.kind, { ErrorGeneric: "Target for link not found" })
t.ok(error.file)
t.equal(error.line, "94")

})*/

/*scenario1.runTape('post max content size 280 characters', async (t, { alice }) => {

const content = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
const in_reply_to = null
Expand Down Expand Up @@ -246,4 +288,4 @@ scenario2.runTape('scenario test create & publish post -> get from other instanc
const result = bob.call("blog", "get_post", params_get)
const value = JSON.parse(result.Ok.App[1])
t.equal(value.content, initialContent)
})
})*/
31 changes: 30 additions & 1 deletion app_spec/zomes/blog/code/src/blog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,35 @@ pub fn handle_create_post(content: String, in_reply_to: Option<Address>) -> Zome
Ok(address)
}

pub fn handle_post_reply_to(content: String, in_reply_to: Option<Address>) -> ZomeApiResult<Address>
{
let address = hdk::entry_address(&post_entry(content))?;
if let Some(in_reply_to_address) = in_reply_to {
hdk::link_entries(&in_reply_to_address, &address, "comments")?;
}
Ok(address)
}

pub fn handle_delete_reply_to(content: String, in_reply_to: Option<Address>) -> ZomeApiResult<Address>
{
let address = hdk::entry_address(&post_entry(content))?;
if let Some(in_reply_to_address) = in_reply_to {
hdk::remove_link(&in_reply_to_address, &address, "comments")?;
}
Ok(address)
}

pub fn handle_my_replies(address : Address) -> ZomeApiResult<GetLinksResult> {
hdk::get_links(&address, "comments")
}

pub fn handle_delete_post(content:String) -> ZomeApiResult<Address>
{
let address = hdk::entry_address(&post_entry(content))?;
hdk::remove_link(&AGENT_ADDRESS,&address.clone(),"authored_posts")?;
Ok(address)
}

pub fn handle_posts_by_agent(agent: Address) -> ZomeApiResult<GetLinksResult> {
hdk::get_links(&agent, "authored_posts")
}
Expand Down Expand Up @@ -137,7 +166,7 @@ pub fn handle_get_post(post_address: Address) -> ZomeApiResult<Option<Entry>> {
hdk::get_entry(&post_address)
}

pub fn handle_delete_post(post_address: Address) -> ZomeApiResult<()> {
pub fn handle_delete_entry_post(post_address: Address) -> ZomeApiResult<()> {
hdk::get_entry(&post_address)?;

hdk::remove_entry(&post_address)?;
Expand Down
28 changes: 26 additions & 2 deletions app_spec/zomes/blog/code/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,33 @@ define_zome! {
}

delete_post: {
inputs: |content: String|,
outputs: |result: ZomeApiResult<Address>|,
handler: blog::handle_delete_post
}

delete_entry_post: {
inputs: |post_address: Address|,
outputs: |result: ZomeApiResult<()>|,
handler: blog::handle_delete_post
handler: blog::handle_delete_entry_post
}

delete_reply_to : {
inputs: |content: String, in_reply_to: Option<Address>|,
outputs: |result: ZomeApiResult<Address>|,
handler: blog::handle_delete_reply_to
}

post_reply_to : {
inputs: |content: String, in_reply_to: Option<Address>|,
outputs: |result: ZomeApiResult<Address>|,
handler: blog::handle_post_reply_to
}

replies : {
inputs: |address:Address|,
outputs: |post_hashes: ZomeApiResult<GetLinksResult>|,
handler: blog::handle_my_replies
}

update_post: {
Expand Down Expand Up @@ -121,7 +145,7 @@ define_zome! {
]

capabilities: {
public (Public) [show_env, check_sum, get_sources, post_address, create_post, delete_post, update_post, posts_by_agent, get_post, my_posts, my_posts_as_committed, my_posts_immediate_timeout, recommend_post, my_recommended_posts]
public (Public) [show_env, check_sum, get_sources, post_address, create_post, delete_post, update_post, posts_by_agent, get_post, my_posts, my_posts_as_committed, my_posts_immediate_timeout, recommend_post, my_recommended_posts,delete_reply_to,post_reply_to,replies]
}

}
71 changes: 52 additions & 19 deletions cas_implementations/src/eav/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,22 +193,44 @@ impl EntityAttributeValueStorage for EavFileStorage {
index_query: IndexQuery,
) -> Result<BTreeSet<EntityAttributeValueIndex>, HolochainError> {
let _guard = self.lock.read()?;
let entity_set = self.read_from_dir::<Entity>(ENTITY_DIR.to_string(), entity.clone())?;
let attribute_set = self
.read_from_dir::<Attribute>(ATTRIBUTE_DIR.to_string(), attribute)?
.clone();
let value_set = self.read_from_dir::<Value>(VALUE_DIR.to_string(), value)?;

let attribute_value_inter: BTreeSet<String> = value_set
.intersection(&attribute_set.clone())
.cloned()
.collect();
let entity_attribute_value_inter: BTreeSet<String> = attribute_value_inter
.intersection(&entity_set)
.cloned()
.collect();

let (eav, error): (BTreeSet<_>, BTreeSet<_>) = entity_attribute_value_inter
let prefixes = if !index_query.prefixes().is_empty() {
index_query.prefixes().clone()
} else {
vec![""]
};
let union_set: BTreeSet<String> = BTreeSet::new();
let entity_attribute_value_union = prefixes.iter().fold(
Ok(union_set.clone()),
|set: Result<BTreeSet<String>, HolochainError>, prefix: &&str| {
let entity_set =
self.read_from_dir::<Entity>(ENTITY_DIR.to_string(), entity.clone())?;
let attribute_with_prefix = attribute
.clone()
.map(|attri| prefix.to_string() + &attri.clone());
let attribute_set = self
.read_from_dir::<Attribute>(ATTRIBUTE_DIR.to_string(), attribute_with_prefix)
.clone()?;
let value_set =
self.read_from_dir::<Value>(VALUE_DIR.to_string(), value.clone())?;

let attribute_value_inter: BTreeSet<String> = value_set
.intersection(&attribute_set.clone())
.cloned()
.collect();
let entity_attribute_value_inter: BTreeSet<String> = attribute_value_inter
.intersection(&entity_set)
.cloned()
.collect();
let to_union = set?;
Ok(to_union
.union(&entity_attribute_value_inter)
.cloned()
.collect())
},
);

let (eav, error): (BTreeSet<_>, BTreeSet<_>) = entity_attribute_value_union?
.clone()
.into_iter()
.map(|content| EntityAttributeValueIndex::try_from_content(&JsonString::from(content)))
.partition(|c| c.is_ok());
Expand All @@ -232,7 +254,7 @@ impl EntityAttributeValueStorage for EavFileStorage {
.start()
.map(|start| start <= e.index())
.unwrap_or_else(|| {
let latest = get_latest(e.clone(), map.clone())
let latest = get_latest(e.clone(), map.clone(), index_query.clone())
.unwrap_or(EntityAttributeValueIndex::default());
latest.index() == e.index()
})
Expand All @@ -242,7 +264,7 @@ impl EntityAttributeValueStorage for EavFileStorage {
.end()
.map(|end| end >= e.index())
.unwrap_or_else(|| {
let latest = get_latest(e.clone(), map.clone())
let latest = get_latest(e.clone(), map.clone(), index_query.clone())
.unwrap_or(EntityAttributeValueIndex::default());
latest.index() == e.index()
})
Expand Down Expand Up @@ -301,11 +323,22 @@ pub mod tests {
}

#[test]
fn example_eav_range() {
fn file_eav_range() {
let temp = tempdir().expect("test was supposed to create temp dir");
let temp_path = String::from(temp.path().to_str().expect("temp dir could not be string"));
let eav_storage = EavFileStorage::new(temp_path).unwrap();
EavTestSuite::test_range::<ExampleAddressableContent, EavFileStorage>(eav_storage);
}

#[test]
fn file_eav_prefixes() {
let temp = tempdir().expect("test was supposed to create temp dir");
let temp_path = String::from(temp.path().to_str().expect("temp dir could not be string"));
let eav_storage = EavFileStorage::new(temp_path).unwrap();
EavTestSuite::test_prefixes::<ExampleAddressableContent, EavFileStorage>(
eav_storage,
vec!["a_", "b_", "c_", "d_"],
);
}

}
19 changes: 16 additions & 3 deletions cas_implementations/src/eav/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,19 @@ impl EntityAttributeValueStorage for EavMemoryStorage {
.into_iter()
.filter(|e| EntityAttributeValueIndex::filter_on_eav(&e.entity(), entity.as_ref()))
.filter(|e| {
EntityAttributeValueIndex::filter_on_eav(&e.attribute(), attribute.as_ref())
EntityAttributeValueIndex::filter_on_eav_with_prefix(
&e.attribute(),
attribute.as_ref(),
&index_query,
)
})
.filter(|e| EntityAttributeValueIndex::filter_on_eav(&e.value(), value.as_ref()))
.filter(|e| {
index_query
.start()
.map(|start| start <= e.index())
.unwrap_or_else(|| {
let latest = get_latest(e.clone(), map.clone())
let latest = get_latest(e.clone(), map.clone(), index_query.clone())
.unwrap_or(EntityAttributeValueIndex::default());
latest.index() == e.index()
})
Expand All @@ -75,7 +79,7 @@ impl EntityAttributeValueStorage for EavMemoryStorage {
.end()
.map(|end| end >= e.index())
.unwrap_or_else(|| {
let latest = get_latest(e.clone(), map.clone())
let latest = get_latest(e.clone(), map.clone(), index_query.clone())
.unwrap_or(EntityAttributeValueIndex::default());
latest.index() == e.index()
})
Expand Down Expand Up @@ -128,4 +132,13 @@ pub mod tests {
EavTestSuite::test_range::<ExampleAddressableContent, EavMemoryStorage>(eav_storage);
}

#[test]
fn file_eav_prefixes() {
let eav_storage = EavMemoryStorage::new();
EavTestSuite::test_prefixes::<ExampleAddressableContent, EavMemoryStorage>(
eav_storage,
vec!["a_", "b_", "c_", "d_"],
);
}

}
Empty file modified conductor/src/main.rs
100755 → 100644
Empty file.
Empty file modified conductor_api/src/lib.rs
100755 → 100644
Empty file.
3 changes: 3 additions & 0 deletions core/src/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ pub enum Action {
/// Does not validate, assumes link is valid.
AddLink(Link),

//Removes a link for the local DHT
RemoveLink(Link),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last I heard about removing links (a few weeks ago), I thought it had to reference the hash of a previously issued AddLink. If so, shouldn't that be part of the action?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per heartbeat, we decided we don't need this for closed alpha and can go forward with this implementation


// ----------------
// Network actions:
// ----------------
Expand Down
1 change: 1 addition & 0 deletions core/src/dht/actions/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod add_link;
pub mod hold;
pub mod remove_entry;
pub mod remove_link;
Loading