Overview
Comment: | Added basic "getchildren" implementation in Tcl |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | tcl-ops |
Files: | files | file ages | folders |
SHA1: |
ee13ee5aa491c95977832ce005e40ce6 |
User & Date: | rkeene on 2014-11-07 08:48:19 |
Other Links: | branch diff | manifest | tags |
Context
2014-11-07
| ||
11:36 | Add "getattr" implementation check-in: d64c2e9bf7 user: rkeene tags: tcl-ops | |
08:48 | Added basic "getchildren" implementation in Tcl check-in: ee13ee5aa4 user: rkeene tags: tcl-ops | |
07:20 | Converted global variables to not be part of a struct check-in: f277407cbc user: rkeene tags: tcl-ops | |
Changes
Modified appfsd.c from [a9240a597b] to [16b07e2510].
︙ | |||
253 254 255 256 257 258 259 | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | if (retval != TCL_OK) { APPFS_DEBUG("Tcl command failed, ::errorInfo contains: %s\n", Tcl_GetVar(interp, "::errorInfo", 0)); } return(retval); } |
︙ | |||
481 482 483 484 485 486 487 | 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 | - - + + - - - - | static int appfs_fuse_getattr(const char *path, struct stat *stbuf) { struct appfs_pathinfo pathinfo; int res = 0; APPFS_DEBUG("Enter (path = %s, ...)", path); |
︙ | |||
532 533 534 535 536 537 538 | 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | - - + + + + - - - + + + - - + + + + + + + + + + + - + + + + + + + | } } return res; } static int appfs_fuse_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi) { |
︙ |
Modified appfsd.tcl from [e0ad1bdba0] to [88b17c4a86].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | + + + + + | #! /usr/bin/env tclsh package require http 2.7 package require sqlite3 package require sha1 namespace eval ::appfs { variable cachedir "/tmp/appfs-cache" variable ttl 3600 variable nttl 60 # User-replacable function to convert a hostname/hash/method to an URL proc _construct_url {hostname hash method} { return "http://$hostname/appfs/$method/$hash" } proc _hash_sep {hash {seps 4}} { for {set idx 0} {$idx < $seps} {incr idx} { append retval "[string range $hash [expr {$idx * 2}] [expr {($idx * 2) + 1}]]/" } append retval "[string range $hash [expr {$idx * 2}] end]" |
︙ | |||
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | + + + + + + - + | # Force [parray] to be loaded catch { parray does_not_exist } set ::appfs::init_called 1 # Load configuration file set config_file [file join $::appfs::cachedir config] if {[file exists $config_file]} { source $config_file } if {![info exists ::appfs::db]} { file mkdir $::appfs::cachedir sqlite3 ::appfs::db [file join $::appfs::cachedir cache.db] } # Create tables db eval {CREATE TABLE IF NOT EXISTS sites(hostname PRIMARY KEY, lastUpdate, ttl);} db eval {CREATE TABLE IF NOT EXISTS packages(hostname, sha1, package, version, os, cpuArch, isLatest, haveManifest);} db eval {CREATE TABLE IF NOT EXISTS files(package_sha1, type, time, source, size, perms, file_sha1, file_name, file_directory);} # Create indexes db eval {CREATE INDEX IF NOT EXISTS sites_index ON sites (hostname);} db eval {CREATE INDEX IF NOT EXISTS packages_index ON packages (hostname, package, version, os, cpuArch);} db eval {CREATE INDEX IF NOT EXISTS files_index ON files (package_sha1, file_name, file_directory);} } proc download {hostname hash {method sha1}} { |
︙ | |||
324 325 326 327 328 329 330 | 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 | - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | db eval {INSERT INTO files (package_sha1, type, time, source, size, perms, file_sha1, file_name, file_directory) VALUES ($package_sha1, $fileInfo(type), $fileInfo(time), $fileInfo(source), $fileInfo(size), $fileInfo(perms), $fileInfo(sha1), $fileInfo(name), $fileInfo(directory) );} db eval {UPDATE packages SET haveManifest = 1 WHERE sha1 = $package_sha1;} } } return COMPLETE } |